Search in sources :

Example 1 with TooManyResourcesException

use of org.evosuite.runtime.TooManyResourcesException 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

InfiniteWhile (com.examples.with.different.packagename.InfiniteWhile)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 TooManyResourcesException (org.evosuite.runtime.TooManyResourcesException)1 EvoClassLoader (org.evosuite.runtime.instrumentation.EvoClassLoader)1 Test (org.junit.Test)1