In my main module, I have some code which uses forName(). In a JUnit test I've created a dummy class which I'm trying to retrieve from the main module.
public class TestClass {
public static class DummyClass implements OtherClass { ... }
@Test
void testCase() {
ParserHandler parserHandler = new ParserHandler();
String fullClassName = DummyEntity.class.getCanonicalName();
// fullClassName is used in the following method which uses forName()
parserHandler.run(fullClassName);
}
Whenever I try this, I get:
java.lang.ClassNotFoundException: com.x.y.TestClass.DummyEntity
How can I resolve this?
Aucun commentaire:
Enregistrer un commentaire