assertEquals( "zoo00", trans.makeUnique( "zoo", x ));
}
@Test
public void testThings() throws Exception {
MockCoberturaManager cm = new MockCoberturaManager();
cm.replaceCoberturaManagerSingleton();
Class<?> stClass = loadInstrumentedClass( "jcr.SampleTest" );
Object st = stClass.newInstance();
Method m = stClass.getMethod( "testMarked" );
m.invoke( st );
List<String> expected = new ArrayList<String>();
expected.add( "jcr" );
assertEquals( expected, cm.getMessages(), "compare " + expected + " v. " + cm.getMessages() );
m = stClass.getMethod( "methodNotMarked" );
m.invoke( st );
assertEquals( expected, cm.getMessages() );
m = stClass.getMethod( "methodMarkedNestedException" );
try {
m.invoke( st );
fail();
}
catch( InvocationTargetException e ) {
assertEquals( "as requested", e.getTargetException().getMessage() );
}
expected.add( "jcr" );
assertEquals( expected, cm.getMessages() );
m = stClass.getMethod( "methodMarked", String.class, Boolean.TYPE);
String result = (String) m.invoke( st, "historic", false );
assertEquals( "prehistoric", result );
expected.add( "jcr" );
assertEquals( expected, cm.getMessages() );
try {
m.invoke( st, "notmatter", true );
fail();
}
catch( InvocationTargetException e ) {
assertEquals( "as requested", e.getTargetException().getMessage() );
}
expected.add( "jcr" );
assertEquals( expected, cm.getMessages() );
m = stClass.getMethod( "testTooSimple" );
m.invoke( st );
expected.add( "jcr" );
assertEquals( expected, cm.getMessages() );
}