Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix buggy test #1364

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading