Skip to content

Commit

Permalink
Change assertions in templated normal test to more realistic ones
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Jul 17, 2024
1 parent a5c779e commit f8aa2e9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
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

0 comments on commit f8aa2e9

Please sign in to comment.