@@ -35,45 +35,25 @@ class InvalidLifecycleMethodConfigurationTests extends AbstractJupiterTestEngine
35
35
36
36
@ Test
37
37
void executeValidTestCaseAlongsideTestCaseWithInvalidNonStaticBeforeAllDeclaration () {
38
- assertExecutionResults (TestCaseWithInvalidNonStaticBeforeAllMethod .class );
39
- }
40
-
41
- @ Test
42
- void executeValidTestCaseAlongsideTestCaseWithInvalidPrivateBeforeAllDeclaration () {
43
- assertExecutionResults (TestCaseWithInvalidPrivateBeforeAllMethod .class );
38
+ assertContainerFailed (TestCaseWithInvalidNonStaticBeforeAllMethod .class );
44
39
}
45
40
46
41
@ Test
47
42
void executeValidTestCaseAlongsideTestCaseWithInvalidNonStaticAfterAllDeclaration () {
48
- assertExecutionResults (TestCaseWithInvalidNonStaticAfterAllMethod .class );
49
- }
50
-
51
- @ Test
52
- void executeValidTestCaseAlongsideTestCaseWithInvalidPrivateAfterAllDeclaration () {
53
- assertExecutionResults (TestCaseWithInvalidPrivateAfterAllMethod .class );
43
+ assertContainerFailed (TestCaseWithInvalidNonStaticAfterAllMethod .class );
54
44
}
55
45
56
46
@ Test
57
47
void executeValidTestCaseAlongsideTestCaseWithInvalidStaticBeforeEachDeclaration () {
58
- assertExecutionResults (TestCaseWithInvalidStaticBeforeEachMethod .class );
59
- }
60
-
61
- @ Test
62
- void executeValidTestCaseAlongsideTestCaseWithInvalidPrivateBeforeEachDeclaration () {
63
- assertExecutionResults (TestCaseWithInvalidPrivateBeforeEachMethod .class );
48
+ assertContainerFailed (TestCaseWithInvalidStaticBeforeEachMethod .class );
64
49
}
65
50
66
51
@ Test
67
52
void executeValidTestCaseAlongsideTestCaseWithInvalidStaticAfterEachDeclaration () {
68
- assertExecutionResults (TestCaseWithInvalidStaticAfterEachMethod .class );
69
- }
70
-
71
- @ Test
72
- void executeValidTestCaseAlongsideTestCaseWithInvalidPrivateAfterEachDeclaration () {
73
- assertExecutionResults (TestCaseWithInvalidPrivateAfterEachMethod .class );
53
+ assertContainerFailed (TestCaseWithInvalidStaticAfterEachMethod .class );
74
54
}
75
55
76
- private void assertExecutionResults (Class <?> invalidTestClass ) {
56
+ private void assertContainerFailed (Class <?> invalidTestClass ) {
77
57
EngineExecutionResults executionResults = executeTests (selectClass (TestCase .class ),
78
58
selectClass (invalidTestClass ));
79
59
Events containers = executionResults .containerEvents ();
@@ -112,18 +92,6 @@ void test() {
112
92
}
113
93
}
114
94
115
- static class TestCaseWithInvalidPrivateBeforeAllMethod {
116
-
117
- // must not be private
118
- @ BeforeAll
119
- private static void beforeAll () {
120
- }
121
-
122
- @ Test
123
- void test () {
124
- }
125
- }
126
-
127
95
static class TestCaseWithInvalidNonStaticAfterAllMethod {
128
96
129
97
// must be static
@@ -136,18 +104,6 @@ void test() {
136
104
}
137
105
}
138
106
139
- static class TestCaseWithInvalidPrivateAfterAllMethod {
140
-
141
- // must not be private
142
- @ AfterAll
143
- private static void afterAll () {
144
- }
145
-
146
- @ Test
147
- void test () {
148
- }
149
- }
150
-
151
107
static class TestCaseWithInvalidStaticBeforeEachMethod {
152
108
153
109
// must NOT be static
@@ -160,18 +116,6 @@ void test() {
160
116
}
161
117
}
162
118
163
- static class TestCaseWithInvalidPrivateBeforeEachMethod {
164
-
165
- // must NOT be private
166
- @ BeforeEach
167
- private void beforeEach () {
168
- }
169
-
170
- @ Test
171
- void test () {
172
- }
173
- }
174
-
175
119
static class TestCaseWithInvalidStaticAfterEachMethod {
176
120
177
121
// must NOT be static
@@ -184,16 +128,4 @@ void test() {
184
128
}
185
129
}
186
130
187
- static class TestCaseWithInvalidPrivateAfterEachMethod {
188
-
189
- // must NOT be private
190
- @ AfterEach
191
- private void afterEach () {
192
- }
193
-
194
- @ Test
195
- void test () {
196
- }
197
- }
198
-
199
131
}
0 commit comments