@Test public void testInitializeClasses(){ EvoClassLoader loader = new EvoClassLoader(); String className = "com.examples.with.different.packagename.classhandling.TimeA"; RuntimeSettings.deactivateAllMocking(); boolean problem = ClassStateSupport.initializeClasses(loader, className); Assert.assertFalse(problem); RuntimeSettings.mockJVMNonDeterminism = true; className = "com.examples.with.different.packagename.classhandling.TimeB"; problem = ClassStateSupport.initializeClasses(loader,className); Assert.assertFalse(problem); }
public static boolean initializeClasses(ClassLoader classLoader, String... classNames) { boolean problem = false; List<Class<?>> classes = loadClasses(classLoader, classNames); if(classes.size() != classNames.length) { problem = true; } initialiseExternalTools(classLoader, classes); if(RuntimeSettings.isUsingAnyMocking()) { for (Class<?> clazz : classes) { if(clazz.isInterface()) { continue; } if (!InstrumentedClass.class.isAssignableFrom(clazz)) { String msg = "Class " + clazz.getName() + " was not instrumented by EvoSuite. " + "This could happen if you are running JUnit tests in a way that is not handled by EvoSuite, in " + "which some classes are loaded be reflection before the tests are run. Consult the EvoSuite documentation " + "for possible workarounds for this issue."; logger.error(msg); problem = true; } } } return problem; }
ClassStateSupport { public static boolean initializeClasses(ClassLoader classLoader, String... classNames) { boolean problem = false; List<Class<?>> classes = loadClasses(classLoader, classNames); if(classes.size() != classNames.length) { problem = true; } initialiseExternalTools(classLoader, classes); if(RuntimeSettings.isUsingAnyMocking()) { for (Class<?> clazz : classes) { if(clazz.isInterface()) { continue; } if (!InstrumentedClass.class.isAssignableFrom(clazz)) { String msg = "Class " + clazz.getName() + " was not instrumented by EvoSuite. " + "This could happen if you are running JUnit tests in a way that is not handled by EvoSuite, in " + "which some classes are loaded be reflection before the tests are run. Consult the EvoSuite documentation " + "for possible workarounds for this issue."; logger.error(msg); problem = true; } } } return problem; } }
ClassStateSupport { public static boolean initializeClasses(ClassLoader classLoader, String... classNames) { boolean problem = false; List<Class<?>> classes = loadClasses(classLoader, classNames); if(classes.size() != classNames.length) { problem = true; } initialiseExternalTools(classLoader, classes); if(RuntimeSettings.isUsingAnyMocking()) { for (Class<?> clazz : classes) { if(clazz.isInterface()) { continue; } if (!InstrumentedClass.class.isAssignableFrom(clazz)) { String msg = "Class " + clazz.getName() + " was not instrumented by EvoSuite. " + "This could happen if you are running JUnit tests in a way that is not handled by EvoSuite, in " + "which some classes are loaded be reflection before the tests are run. Consult the EvoSuite documentation " + "for possible workarounds for this issue."; logger.error(msg); problem = true; } } } return problem; }  }
ClassStateSupport { public static boolean initializeClasses(ClassLoader classLoader, String... classNames) { boolean problem = false; List<Class<?>> classes = loadClasses(classLoader, classNames); if(classes.size() != classNames.length) { problem = true; } initialiseExternalTools(classLoader, classes); if(RuntimeSettings.isUsingAnyMocking()) { for (Class<?> clazz : classes) { if(clazz.isInterface()) { continue; } if (!InstrumentedClass.class.isAssignableFrom(clazz)) { String msg = "Class " + clazz.getName() + " was not instrumented by EvoSuite. " + "This could happen if you are running JUnit tests in a way that is not handled by EvoSuite, in " + "which some classes are loaded be reflection before the tests are run. Consult the EvoSuite documentation " + "for possible workarounds for this issue."; logger.error(msg); problem = true; } } } return problem; }  static boolean initializeClasses(ClassLoader classLoader, String... classNames); static void resetClasses(String... classNames); @Deprecated static void retransformIfNeeded(ClassLoader classLoader, String... classNames); @Deprecated static void retransformIfNeeded(List<Class<?>> classes); }
ClassStateSupport { public static boolean initializeClasses(ClassLoader classLoader, String... classNames) { boolean problem = false; List<Class<?>> classes = loadClasses(classLoader, classNames); if(classes.size() != classNames.length) { problem = true; } initialiseExternalTools(classLoader, classes); if(RuntimeSettings.isUsingAnyMocking()) { for (Class<?> clazz : classes) { if(clazz.isInterface()) { continue; } if (!InstrumentedClass.class.isAssignableFrom(clazz)) { String msg = "Class " + clazz.getName() + " was not instrumented by EvoSuite. " + "This could happen if you are running JUnit tests in a way that is not handled by EvoSuite, in " + "which some classes are loaded be reflection before the tests are run. Consult the EvoSuite documentation " + "for possible workarounds for this issue."; logger.error(msg); problem = true; } } } return problem; }  static boolean initializeClasses(ClassLoader classLoader, String... classNames); static void resetClasses(String... classNames); @Deprecated static void retransformIfNeeded(ClassLoader classLoader, String... classNames); @Deprecated static void retransformIfNeeded(List<Class<?>> classes);  }