/** * Create a list of all methods */ public AllMethodsTestChromosomeFactory() { allMethods.addAll(TestCluster.getInstance().getTestCalls()); Randomness.shuffle(allMethods); reset(); }
@Test public void testTestCalls() throws ConstructionFailedException, NoSuchMethodException, SecurityException { List<GenericAccessibleObject<?>> testCalls = TestCluster.getInstance().getTestCalls(); System.out.println(testCalls.toString()); assertEquals("Expected 5 test calls, but got: " + testCalls.size() + ": " + testCalls, 4, testCalls.size()); }
List<GenericAccessibleObject<?>> calls = cluster.getTestCalls(); for (GenericAccessibleObject<?> call : calls) { if (!call.getDeclaringClass().getName().equals(className)) {
/** * As RESET_STATIC_FINAL_FIELDS=true removes the <code>final</code> modifier * of static fields in the target class, the purpose of this test case is to * check that the TestClusterGenerator indeed does not include these fields. * * * @throws ClassNotFoundException * @throws RuntimeException */ @Test public void test() throws ClassNotFoundException, RuntimeException { Properties.TARGET_CLASS = FinalPrimitiveField.class.getCanonicalName(); Properties.RESET_STATIC_FINAL_FIELDS = true; ClassPathHandler.getInstance().changeTargetCPtoTheSameAsEvoSuite(); String cp = ClassPathHandler.getInstance().getTargetProjectClasspath(); DependencyAnalysis.analyzeClass(Properties.TARGET_CLASS, Arrays.asList(cp.split(File.pathSeparator))); InheritanceTree tree = DependencyAnalysis.getInheritanceTree(); TestClusterGenerator gen = new TestClusterGenerator(tree); assertNotNull(gen); TestCluster cluster = TestCluster.getInstance(); List<GenericAccessibleObject<?>> testCalls = cluster.getTestCalls(); assertEquals("Unexpected number of TestCalls", 2, testCalls.size()); }
/** * As RESET_STATIC_FINAL_FIELDS=true removes the <code>final</code> modifier * of static fields in the target class, the purpose of this test case is to * check that the TestClusterGenerator indeed does not include these fields. * * * @throws ClassNotFoundException * @throws RuntimeException */ @Test public void test() throws ClassNotFoundException, RuntimeException { Properties.TARGET_CLASS = FinalReferenceField.class.getCanonicalName(); Properties.RESET_STATIC_FINAL_FIELDS = true; ClassPathHandler.getInstance().changeTargetCPtoTheSameAsEvoSuite(); String cp = ClassPathHandler.getInstance().getTargetProjectClasspath(); DependencyAnalysis.analyzeClass(Properties.TARGET_CLASS, Arrays.asList(cp.split(File.pathSeparator))); InheritanceTree tree = DependencyAnalysis.getInheritanceTree(); TestClusterGenerator gen = new TestClusterGenerator(tree); assertNotNull(gen); TestCluster cluster = TestCluster.getInstance(); List<GenericAccessibleObject<?>> testCalls = cluster.getTestCalls(); assertEquals("Unexpected number of TestCalls", 2, testCalls.size()); }