Skip to content

Commit

Permalink
test all constructors and addImplementingInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky committed May 21, 2017
1 parent 6cc6435 commit 5565cf7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/java/spoon/test/lambda/LambdaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,17 @@ public void testGetOverriddenMethodWithFunction() throws Exception {

@Test
public void testLambdaFilter() throws Exception {
//check constructor with CtInterface
List<String> methodNames = foo.filterChildren(new LambdaFilter((CtInterface<?>) foo.getNestedType("CheckPerson"))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list();
assertHasStrings(methodNames);
methodNames = foo.filterChildren(new LambdaFilter((CtInterface<?>) foo.getNestedType("Check"))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list();
//check constructor with CtTypeReference
methodNames = foo.filterChildren(new LambdaFilter(foo.getNestedType("Check").getReference())).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list();
assertHasStrings(methodNames, "m", "m6");
methodNames = foo.filterChildren(new LambdaFilter((CtInterface<?>) foo.getNestedType("CheckPersons"))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list();
//check empty constructor and addImplementingInterface with Interface
methodNames = foo.filterChildren(new LambdaFilter().addImplementingInterface((CtInterface<?>) foo.getNestedType("CheckPersons"))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list();
assertHasStrings(methodNames, "m3", "m5");
methodNames = foo.filterChildren(new LambdaFilter(factory.Interface().get(Predicate.class))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list();
//check empty constructor and addImplementingInterface with CtTypeReference
methodNames = foo.filterChildren(new LambdaFilter().addImplementingInterface(factory.createCtTypeReference(Predicate.class))).map((CtLambda l)->l.getParent(CtMethod.class).getSimpleName()).list();
assertHasStrings(methodNames, "m2", "m4", "m7", "m8");
}

Expand Down

0 comments on commit 5565cf7

Please sign in to comment.