use of spoon.test.refactoring.parameter.testclasses.TypeA in project spoon by INRIA.
the class MethodsRefactoringTest method testAllMethodsSameSignatureFunction.
@Test
public void testAllMethodsSameSignatureFunction() {
Factory factory = ModelUtils.build(new File("./src/test/java/spoon/test/refactoring/parameter/testclasses"));
// each executable in test classes is marked with a annotation TestHierarchy,
// which defines the name of the hierarchy where this executable belongs to.
// collect all executables which are marked that they belong to hierarchy A_method1
List<CtExecutable<?>> executablesOfHierarchyA = getExecutablesOfHierarchy(factory, "A_method1");
// check executables of this hierarchy
checkMethodHierarchies(executablesOfHierarchyA);
// collect all executables which are marked that they belong to hierarchy R_method1
List<CtExecutable<?>> executablesOfHierarchyR = getExecutablesOfHierarchy(factory, "R_method1");
// check executables of this hierarchy
checkMethodHierarchies(executablesOfHierarchyR);
// contract: CtConstructor has no other same signature
CtConstructor<?> constructorTypeA = factory.Class().get(TypeA.class).getConstructors().iterator().next();
CtExecutable<?> exec = constructorTypeA.map(new AllMethodsSameSignatureFunction()).first();
assertNull("Unexpected executable found by Constructor of TypeA " + exec, exec);
CtConstructor<?> constructorTypeB = factory.Class().get(TypeB.class).getConstructors().iterator().next();
exec = constructorTypeA.map(new AllMethodsSameSignatureFunction()).first();
assertNull("Unexpected executable found by Constructor of TypeA " + exec, exec);
// contract: constructor is returned if includingSelf == true
assertSame(constructorTypeA, constructorTypeA.map(new AllMethodsSameSignatureFunction().includingSelf(true)).first());
}
Aggregations