use of org.evosuite.instrumentation.InstrumentingClassLoader in project evosuite by EvoSuite.
the class MockJOptionPaneShowMessageDialogTest method testShowMessageDialog0.
@Test
public void testShowMessageDialog0() throws Exception {
TestSuiteChromosome suite = new TestSuiteChromosome();
InstrumentingClassLoader cl = new InstrumentingClassLoader();
TestCase t0 = buildTestCase0TrueBranch(cl);
TestCase t1 = buildTestCase0FalseBranch(cl);
suite.addTest(t0);
suite.addTest(t1);
BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
ff.getFitness(suite);
Set<TestFitnessFunction> coveredGoals = suite.getCoveredGoals();
Assert.assertEquals(3, coveredGoals.size());
}
use of org.evosuite.instrumentation.InstrumentingClassLoader in project evosuite by EvoSuite.
the class MockJOptionPaneShowMessageDialogTest method testShowMessageDialog2.
@Test
public void testShowMessageDialog2() throws Exception {
TestSuiteChromosome suite = new TestSuiteChromosome();
InstrumentingClassLoader cl = new InstrumentingClassLoader();
TestCase t0 = buildTestCase2TrueBranch(cl);
TestCase t1 = buildTestCase2FalseBranch(cl);
suite.addTest(t0);
suite.addTest(t1);
BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
ff.getFitness(suite);
Set<TestFitnessFunction> coveredGoals = suite.getCoveredGoals();
Assert.assertEquals(3, coveredGoals.size());
}
use of org.evosuite.instrumentation.InstrumentingClassLoader in project evosuite by EvoSuite.
the class MockJOptionPaneTest method testShowInputDialogWasFound.
@Test
public void testShowInputDialogWasFound() throws Exception {
boolean hasStringDialog0 = JOptionPaneInputs.getInstance().hasDialog(GUIAction.STRING_INPUT);
assertFalse(hasStringDialog0);
InstrumentingClassLoader cl = new InstrumentingClassLoader();
TestCase t1 = buildTestCase0(cl);
TestCaseExecutor.getInstance().execute(t1);
boolean hasStringDialog = JOptionPaneInputs.getInstance().hasDialog(GUIAction.STRING_INPUT);
assertTrue(hasStringDialog);
}
use of org.evosuite.instrumentation.InstrumentingClassLoader in project evosuite by EvoSuite.
the class MockJOptionPaneTest method testInlinerBug.
@Test
public void testInlinerBug() throws Exception {
Properties.TIMEOUT = Integer.MAX_VALUE;
InstrumentingClassLoader cl = new InstrumentingClassLoader();
TestCase t0 = buildTestCase0(cl);
TestCase t1 = buildTestCase1(cl);
TestSuiteChromosome suite = new TestSuiteChromosome();
suite.addTest(t0);
suite.addTest(t1);
System.out.println(suite.toString());
BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
ff.getFitness(suite);
ConstantInliner inliner = new ConstantInliner();
inliner.inline(suite);
System.out.println(suite.toString());
List<ExecutionResult> execResults = suite.getLastExecutionResults();
assertEquals(2, execResults.size());
ExecutionResult r1 = execResults.get(0);
ExecutionResult r2 = execResults.get(1);
r1.calledReflection();
r2.calledReflection();
}
use of org.evosuite.instrumentation.InstrumentingClassLoader in project evosuite by EvoSuite.
the class ParentReplacementTest method testWithVFS.
@Test
public void testWithVFS() throws ClassNotFoundException {
RuntimeSettings.useVFS = true;
Properties.VIRTUAL_FS = true;
InstrumentingClassLoader cl = new InstrumentingClassLoader();
Class<?> clazz = cl.loadClass(ExtendingFile.class.getCanonicalName());
Class<?> parent = clazz.getSuperclass();
Assert.assertEquals(MockFile.class.getCanonicalName(), parent.getCanonicalName());
}
Aggregations