Skip to content

Commit

Permalink
test: relax intercession test to prepare #2615 (#2706)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky authored and monperrus committed Oct 22, 2018
1 parent 4f70ab1 commit 499f0b5
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/test/java/spoon/test/intercession/IntercessionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,9 @@ public boolean matches(CtMethod<?> element) {
for (CtMethod<?> setter : setters) {
final String methodLog = setter.getSimpleName() + " in " +
setter.getDeclaringType().getSimpleName();
if (setter.getFormalCtTypeParameters().size() <= 0) {
fail("Your setter " + methodLog + " don't have a generic type for its return type.");
}
boolean isMatch = false;
// New type parameter declaration.
for (CtTypeParameter typeParameter : setter.getFormalCtTypeParameters()) {
if (setter.getType().getSimpleName().equals(typeParameter.getSimpleName())) {
isMatch = true;

if (setter.getAnnotation(Override.class) != null) {
// Override annotation means that the current method come from a super
Expand All @@ -248,11 +243,10 @@ public boolean matches(CtMethod<?> element) {
}

if (!setter.getDeclaringType().getSimpleName().equals(typeParameter.getSuperclass().getSimpleName())) {
fail("Your setter " + methodLog + " has a type reference who don't extends " + setter.getDeclaringType().getSimpleName());
fail("Your setter " + methodLog + " has a type reference who doesn't extends " + setter.getDeclaringType().getSimpleName());
}
}
}
assertTrue("The type of " + methodLog + " don't match with generic types.", isMatch);
}
}

Expand Down

0 comments on commit 499f0b5

Please sign in to comment.