Skip to content

Commit

Permalink
Merge pull request #1364 from hcoles/feature/exclusion_test_fix
Browse files Browse the repository at this point in the history
fix buggy test
  • Loading branch information
hcoles authored Nov 12, 2024
2 parents 7ec969b + b37089b commit ef51bb5
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void shouldDeclareSelfAsFilter() {
public void shouldNotFilterMutationsWhenNoAnnotations() {
v.forClass(UnAnnotated.class)
.forAnyCode()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();
}
Expand All @@ -38,6 +39,7 @@ public void shouldNotFilterMutationsWhenNoAnnotations() {
public void shouldFilterAllMutationsForClassesWithGeneratedAnnotation() {
v.forClass(AnnotatedWithGenerated.class)
.forAnyCode()
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();
}
Expand All @@ -46,6 +48,7 @@ public void shouldFilterAllMutationsForClassesWithGeneratedAnnotation() {
public void shouldFilterAllMutationsForClassesWithDoNoMutateAnnotation() {
v.forClass(AnnotatedWithDoNotMutate.class)
.forAnyCode()
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();
}
Expand All @@ -55,12 +58,14 @@ public void shouldFilterMethodsWithGeneratedAnnotation() {
v.forClass(MethodAnnotatedWithGenerated.class)
.forMethod("foo")
.forAnyCode()
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();

v.forClass(MethodAnnotatedWithGenerated.class)
.forMethod("bar")
.forAnyCode()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();

Expand All @@ -70,23 +75,26 @@ public void shouldFilterMethodsWithGeneratedAnnotation() {
public void shouldNotFilterMutationsInUnannotatedMethod() {
v.forClass(UnannotatedMethodClass.class)
.forAnyCode()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();
}

@Test
public void shouldFilterMutationsInAnnotatedMethod() {
v.forClass(UnannotatedMethodClass.class)
.forMethod("annotatedMethod")
.forMethod("unannotatedMethod")
.forAnyCode()
.allMutantsAreFiltered()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();
}

@Test
public void shouldNotFilterMutationsInLambdaWithinUnannotatedMethod() {
v.forClass(LambdaInUnannotatedMethodClass.class)
.forAnyCode()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();
}
Expand All @@ -95,6 +103,7 @@ public void shouldNotFilterMutationsInLambdaWithinUnannotatedMethod() {
public void shouldFilterMutationsInLambdaWithinAnnotatedMethod() {
v.forClass(LambdaInAnnotatedMethodClass.class)
.forMutantsMatching( m -> !m.getMethod().equals("<init>"))
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();
}
Expand All @@ -104,24 +113,28 @@ public void shouldHandleOverloadedMethodsWithLambdas() {
v.forClass(OverloadedMethods.class)
.forMethod("foo", "(Ljava/lang/String;)V")
.forAnyCode()
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();

v.forClass(OverloadedMethods.class)
.forMethod("lambda$foo$1", "()V")
.forAnyCode()
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();

v.forClass(OverloadedMethods.class)
.forMethod("lambda$foo$0", "()V")
.forAnyCode()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();

v.forClass(OverloadedMethods.class)
.forMethod("bar")
.forAnyCode()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();

Expand All @@ -132,30 +145,35 @@ public void shouldNotFilterMutationsInNestedLambdaWithinUnannotatedOverloadedMet
v.forClass(NestedLambdaInOverloadedMethods.class)
.forMethod("baz", "(Ljava/lang/String;)V")
.forAnyCode()
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();

v.forClass(NestedLambdaInOverloadedMethods.class)
.forMethod("lambda$baz$3")
.forAnyCode()
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();

v.forClass(NestedLambdaInOverloadedMethods.class)
.forMethod("lambda$baz$2")
.forAnyCode()
//.mutantsAreGenerated() no check as java8 produces different bytecode
.allMutantsAreFiltered()
.verify();

v.forClass(NestedLambdaInOverloadedMethods.class)
.forMethod("lambda$baz$0")
.forAnyCode()
//.mutantsAreGenerated() no check as java8 produces different bytecode
.noMutantsAreFiltered()
.verify();

v.forClass(NestedLambdaInOverloadedMethods.class)
.forMethod("lambda$baz$1")
.forAnyCode()
.mutantsAreGenerated()
.noMutantsAreFiltered()
.verify();

Expand All @@ -165,6 +183,7 @@ public void shouldNotFilterMutationsInNestedLambdaWithinUnannotatedOverloadedMet
public void shouldFilterMutationsInNestedLambdaWithinAnnotatedOverloadedMethod() {
v.forClass(NestedLambdaInOverloadedMethods.class)
.forMutantsMatching(mutation -> mutation.getId().getLocation().getMethodDesc().equals("(Ljava/lang/String;)V"))
.mutantsAreGenerated()
.allMutantsAreFiltered()
.verify();
}
Expand Down

0 comments on commit ef51bb5

Please sign in to comment.