use of org.evosuite.junit.naming.methods.GoalComparator in project evosuite by EvoSuite.
the class TestGoalComparator method testCompareEqual.
@Test
public void testCompareEqual() {
GoalComparator comparator = new GoalComparator();
ExceptionCoverageTestFitness goal1 = new ExceptionCoverageTestFitness("FooClass", "toString()", MockArithmeticException.class, ExceptionCoverageTestFitness.ExceptionType.EXPLICIT);
ExceptionCoverageTestFitness goal2 = new ExceptionCoverageTestFitness("FooClass", "toString()", MockArithmeticException.class, ExceptionCoverageTestFitness.ExceptionType.EXPLICIT);
assertEquals(0, comparator.compare(goal1, goal2));
}
use of org.evosuite.junit.naming.methods.GoalComparator in project evosuite by EvoSuite.
the class TestGoalComparator method testComparatorList.
@Test
public void testComparatorList() {
GoalComparator comparator = new GoalComparator();
MethodCoverageTestFitness goal1 = new MethodCoverageTestFitness("FooClass", "toString()");
ExceptionCoverageTestFitness goal2 = new ExceptionCoverageTestFitness("FooClass", "toString()", MockArithmeticException.class, ExceptionCoverageTestFitness.ExceptionType.EXPLICIT);
OutputCoverageGoal outputGoal = new OutputCoverageGoal("FooClass", "toString", Type.getType("Ljava.lang.String;"), IOCoverageConstants.REF_NONNULL);
OutputCoverageTestFitness goal3 = new OutputCoverageTestFitness(outputGoal);
List<TestFitnessFunction> goals = new ArrayList<>();
goals.add(goal1);
goals.add(goal2);
goals.add(goal3);
Collections.sort(goals, comparator);
assertEquals(goal2, goals.get(0));
}
use of org.evosuite.junit.naming.methods.GoalComparator in project evosuite by EvoSuite.
the class TestGoalComparator method testCompareExceptionMethod.
@Test
public void testCompareExceptionMethod() {
GoalComparator comparator = new GoalComparator();
MethodCoverageTestFitness goal1 = new MethodCoverageTestFitness("FooClass", "toString()");
ExceptionCoverageTestFitness goal2 = new ExceptionCoverageTestFitness("FooClass", "toString()", MockArithmeticException.class, ExceptionCoverageTestFitness.ExceptionType.EXPLICIT);
assertEquals(1, comparator.compare(goal1, goal2));
}
Aggregations