use of com.examples.with.different.packagename.agent.ExceptionHolder in project evosuite by EvoSuite.
the class InstrumentingAgent_exceptionsIntTest method testReplacementCallInSubClassOfException.
@Test
public void testReplacementCallInSubClassOfException() {
Object obj = null;
try {
InstrumentingAgent.activate();
obj = new ExceptionHolder();
} finally {
InstrumentingAgent.deactivate();
}
try {
MockFramework.enable();
StackTraceElement[] traces = new MockThrowable().getStackTrace();
ExceptionHolder eh = (ExceptionHolder) obj;
StackTraceElement[] b = eh.getTraces();
Assert.assertEquals(traces[1], b[1]);
} finally {
MockFramework.disable();
}
}
use of com.examples.with.different.packagename.agent.ExceptionHolder in project evosuite by EvoSuite.
the class InstrumentingAgent_exceptionsIntTest method testExceptions.
@Test
public void testExceptions() {
Object obj = null;
try {
InstrumentingAgent.activate();
obj = new ExceptionHolder();
} finally {
InstrumentingAgent.deactivate();
}
try {
MockFramework.enable();
ExceptionHolder eh = (ExceptionHolder) obj;
Assert.assertFalse(eh.getNonMockedNPE() instanceof EvoSuiteMock);
Assert.assertTrue(eh.getMockedThrowable() instanceof EvoSuiteMock);
StackTraceElement[] traces = new MockThrowable().getStackTrace();
StackTraceElement[] a = eh.getTracesWhenCast();
Assert.assertEquals(traces[1], a[1]);
} finally {
MockFramework.disable();
}
}
Aggregations