public void testTestClassNotLoadableFromJUnitClassLoader()
throws Exception
{
// can't use Description.createTestDescription() methods as these require a loaded Class
Description testDescription =
Description.createSuiteDescription( "testMethod(cannot.be.loaded.by.junit.Test)" );
assertEquals( "testMethod", testDescription.getMethodName() );
assertEquals( "cannot.be.loaded.by.junit.Test", testDescription.getClassName() );
// assert that the test class is not visible by the JUnit classloader
assertNull( testDescription.getTestClass() );
Description suiteDescription = Description.createSuiteDescription( "testSuite" );
suiteDescription.addChild( testDescription );
Map<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
JUnitCoreRunListener listener = new JUnitCoreRunListener( new MockReporter(), classMethodCounts );
listener.testRunStarted( suiteDescription );
assertEquals( 1, classMethodCounts.size() );
TestSet testSet = classMethodCounts.get( "cannot.be.loaded.by.junit.Test" );