Closed 6bangs closed 8 years ago
Thanks! It's a bug indeed, and not limited to multiple tests; the simplified test below also reproduces it:
public class ParameterNameExtractionTest
{
static class A
{
A() {}
A(int i) {}
void doSomething(boolean b) {}
}
@Tested A a1; // causes parameter name extraction for class A
@Test
public void mockClassPreviouslyUsedInTestedField(@Mocked final A a2)
{
new Verifications() {{
a2.doSomething(true); // NPE here, as extraction missed "doSomething(boolean)"
times = 0;
}};
}
}
Ahh, glad to get a peek at what's going on under the covers :)
I debugged far enough to understand that @Tested caused parameter name extraction, but didn't have time yesterday to dig deeper. Looking forward to reading the fix!
Minimum example:
If Test1 is run before Test2, an NPE is raised with the following stack trace:
However, if Test2 is run first, both tests pass.
JMockit version: 1.21 JUnit version: 4.11