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

Change assertions in templated normal test to more realistic ones #41958

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
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 @@ -59,7 +59,7 @@ public void testThatTheTestsPassed() throws MavenInvocationException, IOExceptio
// This is a bit brittle when we add tests, but failures are often so catastrophic they're not even reported as failures,
// so we need to check the pass count explicitly
Assertions.assertEquals(0, results.getTestsFailed());
Assertions.assertEquals(9, results.getTestsPassed());
Assertions.assertEquals(8, results.getTestsPassed());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void testThatTheTestsPassed() throws MavenInvocationException, IOExceptio
// This is a bit brittle when we add tests, but failures are often so catastrophic they're not even reported as failures,
// so we need to check the pass count explicitly
Assertions.assertEquals(0, results.getTestsFailed());
Assertions.assertEquals(9, results.getTestsPassed());
Assertions.assertEquals(8, results.getTestsPassed());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// No QuarkusTest annotation

/**
* It's likely we would never expect this to work; unit tests which don't have a @QuarkusTest
* It's likely we would never expect Quarkus bytecode changes to be visible in this kind of test; unit tests which don't have
* annotation would not be able to
* benefit from bytecode manipulations from extensions.
*/
Expand Down Expand Up @@ -46,22 +46,8 @@ void classloaderIntrospectionTestTemplate(ExtensionContext context) {
@TestTemplate
@ExtendWith(MyContextProvider.class)
void contextAnnotationCheckingTestTemplate(ExtensionContext context) {
Annotation[] contextAnnotations = context.getRequiredTestClass()
.getAnnotations();
Assertions.assertTrue(Arrays.toString(contextAnnotations)
.contains("AnnotationAddedByExtension"),
"The JUnit extension context does not see the annotation, only sees " + Arrays.toString(
contextAnnotations));
// We don't expect to see the annotations because we don't have a @QuarkusTest annotation, but the basic test should work
Assertions.assertEquals(true, true);
}

@TestTemplate
@ExtendWith(MyContextProvider.class)
void executionAnnotationCheckingTestTemplate(ExtensionContext context) {
Annotation[] myAnnotations = this.getClass()
.getAnnotations();
Assertions.assertTrue(Arrays.toString(myAnnotations)
.contains("AnnotationAddedByExtension"),
"The test execution does not see the annotation, only sees " + Arrays.toString(
myAnnotations));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
// No QuarkusTest annotation

/**
* It's likely we would never expect this to work; unit tests which don't have a @QuarkusTest
* It's likely we would never expect Quarkus bytecode changes to be visible in this kind of test; unit tests which don't have
* a @QuarkusTest
* annotation would not be able to
* benefit from bytecode manipulations from extensions.
*/
Expand Down