Hello,
I'm using Jacoco and testing AntLR visitor rules. I have got a parser which does not implement all methods, but these methods return "null", so I would like to check it for the line coverage if they really return null.
So I have written a test with a data provider, which put the parameter class into and the method name:
@Test
@UseDataProvider( "nullrules" )
public void nullreturnrules( @Nonnull final Pair<Class<?>, String> p_rule ) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
{
final ManualVisitor<Object> l_visitor = new CASTVisitorManual();
Assert.assertNull(
l_visitor.getClass().getMethod(
p_rule.getRight(),
p_rule.getLeft()
).invoke(
l_visitor,
Mockito.mock(
p_rule.getLeft()
)
)
);
}
So the pair is for example: ManualParser.TernaryoperationContext.class and "visitTernaryoperation"
How can I tell JaCoCo agent that it should count the coverage?
Thanks
Phil