Closed
Description
Description
If we are generating tests for a method of package-private class, fuzzer will use reflection to instantiate it, even though it is not needed. Note that this only works for methods that have at least one argument.
To Reproduce
Launch plugin on the following class (not that it must be package-private):
class A {
int f(int x) {
return 0;
}
}
Expected behavior
Instances of A
in generated tests are produced via default constructor
Actual behavior
Instances are produced via reflection.
Visual proofs (screenshots, logs, images)
The following test is generated:
@Test
@DisplayName("f: x > 0 -> return 0")
public void testFReturnsZero() throws Exception {
A a = ((A) createInstance("arrays.A"));
int actual = a.f(1);
assertEquals(0, actual);
}
Environment
Fuzzer should be enabled. Default amount of time for fuzzer is enough.
Metadata
Metadata
Assignees
Type
Projects
Status
Done