use of org.evosuite.EvoSuite in project evosuite by EvoSuite.
the class StaticInitThrowsNullPointerSystemTest method testWithNoReset.
/*
* These tests are based on issues found on project 44_summa, which is using the lucene API.
* those have issues when for example classes uses org.apache.lucene.util.Constants which has:
*
try {
Collections.class.getMethod("emptySortedSet");
} catch (NoSuchMethodException nsme) {
v8 = false;
}
*
* in its static initializer
*/
@Test
public void testWithNoReset() {
Properties.RESET_STATIC_FIELDS = false;
EvoSuite evosuite = new EvoSuite();
String targetClass = StaticInitThrowsNullPointer.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
assertTrue(result instanceof List);
List<?> list = (List<?>) result;
assertEquals(0, list.size());
}
use of org.evosuite.EvoSuite in project evosuite by EvoSuite.
the class MockJOptionPaneSystemTest method testShowConfirmDialogs2.
@Test
public void testShowConfirmDialogs2() throws Exception {
final String targetClass = AskUserShowConfirmDialogs2.class.getCanonicalName();
Properties.TEST_ARCHIVE = false;
Properties.CRITERION = new Properties.Criterion[] { Properties.Criterion.BRANCH };
Properties.TARGET_CLASS = targetClass;
Properties.REPLACE_GUI = true;
Properties.MINIMIZE = true;
// As mutation operators remove instrumentation. This needs fixing first
Properties.ASSERTIONS = false;
EvoSuite evosuite = new EvoSuite();
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
Assert.assertNotNull(best);
Assert.assertEquals("Non-optimal coverage: ", 1d, best.getCoverage(), 0.001);
Assert.assertEquals("Non-optimal fitness: ", 0d, best.getFitness(), 0.001);
}
use of org.evosuite.EvoSuite in project evosuite by EvoSuite.
the class MockJOptionPaneSystemTest method testShowOptionDialogExample.
@Test
public void testShowOptionDialogExample() throws Exception {
final String targetClass = AskUserShowOptionDialog.class.getCanonicalName();
Properties.TEST_ARCHIVE = false;
Properties.CRITERION = new Properties.Criterion[] { Properties.Criterion.BRANCH };
Properties.TARGET_CLASS = targetClass;
Properties.REPLACE_GUI = true;
Properties.MINIMIZE = true;
// As mutation operators remove instrumentation. This needs fixing first
Properties.ASSERTIONS = false;
EvoSuite evosuite = new EvoSuite();
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
Assert.assertNotNull(best);
Assert.assertEquals("Non-optimal coverage: ", 1d, best.getCoverage(), 0.001);
Assert.assertEquals("Non-optimal fitness: ", 0d, best.getFitness(), 0.001);
}
use of org.evosuite.EvoSuite in project evosuite by EvoSuite.
the class MockJOptionPaneSystemTest method testShowInputMultipleDialogs.
@Test
public void testShowInputMultipleDialogs() throws Exception {
final String targetClass = AskUserShowInputDailogs.class.getCanonicalName();
Properties.TEST_ARCHIVE = false;
Properties.CRITERION = new Properties.Criterion[] { Properties.Criterion.BRANCH };
Properties.TARGET_CLASS = targetClass;
Properties.REPLACE_GUI = true;
Properties.MINIMIZE = true;
// As mutation operators remove instrumentation. This needs fixing first
Properties.ASSERTIONS = false;
EvoSuite evosuite = new EvoSuite();
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
Assert.assertNotNull(best);
Assert.assertEquals("Non-optimal coverage: ", 1d, best.getCoverage(), 0.001);
Assert.assertEquals("Non-optimal fitness: ", 0d, best.getFitness(), 0.001);
}
use of org.evosuite.EvoSuite in project evosuite by EvoSuite.
the class MockJOptionPaneSystemTest method testShowConfirmDialogs0.
@Test
public void testShowConfirmDialogs0() throws Exception {
final String targetClass = AskUserShowConfirmDialogs0.class.getCanonicalName();
Properties.TEST_ARCHIVE = false;
Properties.CRITERION = new Properties.Criterion[] { Properties.Criterion.BRANCH };
Properties.TARGET_CLASS = targetClass;
Properties.REPLACE_GUI = true;
Properties.MINIMIZE = true;
// As mutation operators remove instrumentation. This needs fixing first
Properties.ASSERTIONS = false;
EvoSuite evosuite = new EvoSuite();
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
Assert.assertNotNull(best);
Assert.assertEquals("Non-optimal coverage: ", 1d, best.getCoverage(), 0.001);
Assert.assertEquals("Non-optimal fitness: ", 0d, best.getFitness(), 0.001);
}
Aggregations