Search in sources :

Example 6 with EvoClassLoader

use of org.evosuite.runtime.instrumentation.EvoClassLoader in project evosuite by EvoSuite.

the class InfiniteWhile_SystemTest method testLoading.

@Test(timeout = 5000)
public void testLoading() throws Exception {
    EvoClassLoader loader = new EvoClassLoader();
    Class<?> clazz = loader.loadClass(InfiniteWhile.class.getCanonicalName());
    Method m = clazz.getMethod("infiniteLoop");
    try {
        m.invoke(null);
        fail();
    } catch (InvocationTargetException e) {
        // expected
        Assert.assertTrue(e.getCause() instanceof TooManyResourcesException);
    }
}
Also used : InfiniteWhile(com.examples.with.different.packagename.InfiniteWhile) EvoClassLoader(org.evosuite.runtime.instrumentation.EvoClassLoader) TooManyResourcesException(org.evosuite.runtime.TooManyResourcesException) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) Test(org.junit.Test)

Aggregations

EvoClassLoader (org.evosuite.runtime.instrumentation.EvoClassLoader)6 Method (java.lang.reflect.Method)4 Test (org.junit.Test)4 InfiniteWhile (com.examples.with.different.packagename.InfiniteWhile)1 IssueWithNumber (com.examples.with.different.packagename.fm.IssueWithNumber)1 ReadFromURL (com.examples.with.different.packagename.mock.java.net.ReadFromURL)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 TooManyResourcesException (org.evosuite.runtime.TooManyResourcesException)1 EvoSuiteURL (org.evosuite.runtime.testdata.EvoSuiteURL)1 GenericMethod (org.evosuite.utils.generic.GenericMethod)1 InitializationError (org.junit.runners.model.InitializationError)1