You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose we have a class with a public final field whose content can be modified (e.g., an array):
public class PublicFinalFieldExample {
public final int[] data = {1, 2};
public boolean foo(int x) {
return x == data[0];
}
}
Expected behavior:
UtAssembleModel is not created, final field is set via reflection.
Actual behavior:
The generated tests for foo contain the direct assignment to the data field instead of assignment to the array elements or changing the field value using reflection:
@Test
--
@DisplayName("foo: return data[0] == x : False -> return data[0] == x")
public void testFoo_0OfDataNotEqualsX() throws Throwable {
PublicFinalArrayExample publicFinalArrayExample = new PublicFinalArrayExample();
int[] intArray = new int[1];
intArray[0] = 1;
publicFinalArrayExample.data = intArray; // Error: this line does not compile
boolean actual = publicFinalArrayExample.foo(-224);
assertFalse(actual);
}
Testing instructions:
AssembleModelGeneratorTests should be enlarged with one more test for objects with final fields.
Other tests should still pass.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Suppose we have a class with a public final field whose content can be modified (e.g., an array):
Expected behavior:
UtAssembleModel is not created, final field is set via reflection.
Actual behavior:
The generated tests for foo contain the direct assignment to the data field instead of assignment to the array elements or changing the field value using reflection:
Testing instructions:
AssembleModelGeneratorTests should be enlarged with one more test for objects with final fields.
Other tests should still pass.
The text was updated successfully, but these errors were encountered: