This question is about JMockit. I know how to verify that a specific method has not been called for a class, for example:
new Expectations() {{
writer.writeString(anyString); times = 0;
}};
Now, my writer has a bunch of methods called writeString, writeBoolean, writeArray, etc, and I want to verify that none of them has been called. Is it possible to do so using some kind regex/method name matching? Thanks
You should be able to achieve that with the FullVerifications
class. Something like:
@Test
public void myTest(@Mocked final Writer writer)
{
codeUnderTest.doSomething(writer);
new FullVerifications(writer) {{
// Expected calls verified here.
// Calls not expected will cause an "unexpected invocation" if detected.
}};
}