2323
2424import org .junit .jupiter .api .Test ;
2525import org .pitest .junit5 .repository .TestClassWithAbortingTest ;
26+ import org .pitest .junit5 .repository .TestClassWithBeforeAll ;
27+ import org .pitest .junit5 .repository .TestClassWithFailingBeforeAll ;
2628import org .pitest .junit5 .repository .TestClassWithFailingTest ;
2729import org .pitest .junit5 .repository .TestClassWithInheritedTestMethod ;
2830import org .pitest .junit5 .repository .TestClassWithNestedAnnotationAndNestedTestAnnotation ;
3941 *
4042 * @author tobias
4143 */
42- public class JUnit5TestUnitTest {
44+ class JUnit5TestUnitTest {
4345
4446 @ Test
45- public void testTestClassWithTestAnnotation () {
47+ void testTestClassWithTestAnnotation () {
4648 TestResultCollector resultCollector = findTestsIn (TestClassWithTestAnnotation .class );
4749
4850 assertThat (resultCollector .getSkipped ()).isEmpty ();
@@ -51,7 +53,7 @@ public void testTestClassWithTestAnnotation() {
5153 }
5254
5355 @ Test
54- public void test3TestClassWithTestFactoryAnnotation () {
56+ void test3TestClassWithTestFactoryAnnotation () {
5557 TestResultCollector resultCollector = findTestsIn (TestClassWithTestFactoryAnnotation .class );
5658
5759 assertThat (resultCollector .getSkipped ()).isEmpty ();
@@ -60,7 +62,7 @@ public void test3TestClassWithTestFactoryAnnotation() {
6062 }
6163
6264 @ Test
63- public void testTestClassWithNestedAnnotationAndNestedTestAnnotation () {
65+ void testTestClassWithNestedAnnotationAndNestedTestAnnotation () {
6466 TestResultCollector resultCollector =
6567 findTestsIn (TestClassWithNestedAnnotationAndNestedTestAnnotation .class );
6668
@@ -71,7 +73,7 @@ public void testTestClassWithNestedAnnotationAndNestedTestAnnotation() {
7173
7274
7375 @ Test
74- public void testTestClassWithNestedAnnotationAndNestedTestFactoryAnnotation () {
76+ void testTestClassWithNestedAnnotationAndNestedTestFactoryAnnotation () {
7577 TestResultCollector resultCollector =
7678 findTestsIn (TestClassWithNestedAnnotationAndNestedTestFactoryAnnotation .class );
7779
@@ -81,7 +83,7 @@ public void testTestClassWithNestedAnnotationAndNestedTestFactoryAnnotation() {
8183 }
8284
8385 @ Test
84- public void testTestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestAnnotation () {
86+ void testTestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestAnnotation () {
8587 TestResultCollector resultCollector =
8688 findTestsIn (TestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestAnnotation .class );
8789
@@ -91,7 +93,7 @@ public void testTestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestAn
9193 }
9294
9395 @ Test
94- public void testTestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestFactoryAnnotation () {
96+ void testTestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestFactoryAnnotation () {
9597 TestResultCollector resultCollector =
9698 findTestsIn (TestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestFactoryAnnotation .class );
9799
@@ -101,7 +103,7 @@ public void testTestClassWithNestedAnnotationWithNestedAnnotationAndNestedTestFa
101103 }
102104
103105 @ Test
104- public void testTestClassWithInheritedTestMethod () {
106+ void testTestClassWithInheritedTestMethod () {
105107 TestResultCollector resultCollector =
106108 findTestsIn (TestClassWithInheritedTestMethod .class );
107109
@@ -111,7 +113,7 @@ public void testTestClassWithInheritedTestMethod() {
111113 }
112114
113115 @ Test
114- public void testTestClassWithFailingTest () {
116+ void testTestClassWithFailingTest () {
115117 TestResultCollector resultCollector = findTestsIn (TestClassWithFailingTest .class );
116118
117119 assertThat (resultCollector .getSkipped ()).isEmpty ();
@@ -121,14 +123,33 @@ public void testTestClassWithFailingTest() {
121123 }
122124
123125 @ Test
124- public void testTestClassWithAbortingTest () {
126+ void testTestClassWithAbortingTest () {
125127 TestResultCollector resultCollector = findTestsIn (TestClassWithAbortingTest .class );
126128
127129 assertThat (resultCollector .getSkipped ()).isEmpty ();
128130 assertThat (resultCollector .getStarted ()).hasSize (1 );
129131 assertThat (resultCollector .getEnded ()).hasSize (1 );
130132 assertThat (resultCollector .getFailure ()).isEmpty ();
131133 }
134+
135+ @ Test
136+ void testRunsBeforeAlls () {
137+ TestResultCollector resultCollector = findTestsIn (TestClassWithBeforeAll .class );
138+
139+ assertThat (resultCollector .getSkipped ()).isEmpty ();
140+ assertThat (resultCollector .getStarted ()).hasSize (2 );
141+ assertThat (resultCollector .getFailure ()).isEmpty ();
142+ }
143+
144+ @ Test
145+ void testFailsWhenBeforeAllFails () {
146+ TestResultCollector resultCollector = findTestsIn (TestClassWithFailingBeforeAll .class );
147+
148+ assertThat (resultCollector .getSkipped ()).isEmpty ();
149+ assertThat (resultCollector .getStarted ()).hasSize (0 );
150+ assertThat (resultCollector .getFailure ()).isPresent ();
151+ }
152+
132153
133154 private TestResultCollector findTestsIn (Class <?> clazz ) {
134155 TestResultCollector resultCollector = new TestResultCollector ();
0 commit comments