2424
2525package hudson .cli .handlers ;
2626
27- import static org .junit .Assert .assertEquals ;
28- import static org .junit .Assert .assertNull ;
29- import static org .junit .Assert .assertThrows ;
27+ import static org .junit .jupiter . api . Assertions .assertEquals ;
28+ import static org .junit .jupiter . api . Assertions .assertNull ;
29+ import static org .junit .jupiter . api . Assertions .assertThrows ;
3030import static org .mockito .Mockito .doThrow ;
3131import static org .mockito .Mockito .mock ;
3232import static org .mockito .Mockito .mockStatic ;
4040import hudson .security .ACL ;
4141import hudson .security .Permission ;
4242import jenkins .model .Jenkins ;
43- import org .junit .After ;
44- import org .junit .Before ;
45- import org .junit .Test ;
43+ import org .junit .jupiter . api . AfterEach ;
44+ import org .junit .jupiter . api . BeforeEach ;
45+ import org .junit .jupiter . api . Test ;
4646import org .kohsuke .args4j .CmdLineException ;
4747import org .kohsuke .args4j .spi .Parameters ;
4848import org .kohsuke .args4j .spi .Setter ;
5252import org .springframework .security .access .AccessDeniedException ;
5353import org .springframework .security .core .Authentication ;
5454
55- public class ViewOptionHandlerTest {
55+ class ViewOptionHandlerTest {
5656
5757 @ Mock private Setter <View > setter ;
5858 private ViewOptionHandler handler ;
@@ -65,12 +65,13 @@ public class ViewOptionHandlerTest {
6565
6666 private AutoCloseable mocks ;
6767
68- @ After
69- public void tearDown () throws Exception {
68+ @ AfterEach
69+ void tearDown () throws Exception {
7070 mocks .close ();
7171 }
7272
73- @ Before public void setUp () {
73+ @ BeforeEach
74+ void setUp () {
7475
7576 mocks = MockitoAnnotations .openMocks (this );
7677
@@ -88,7 +89,8 @@ public void tearDown() throws Exception {
8889 when (outer .getView ("nested" )).thenReturn (nested );
8990 }
9091
91- @ Test public void resolveTopLevelView () throws Exception {
92+ @ Test
93+ void resolveTopLevelView () throws Exception {
9294 Jenkins jenkins = mock (Jenkins .class );
9395 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
9496 mockJenkins (mocked , jenkins );
@@ -110,7 +112,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
110112 });
111113 }
112114
113- @ Test public void resolveNestedView () throws Exception {
115+ @ Test
116+ void resolveNestedView () throws Exception {
114117 Jenkins jenkins = mock (Jenkins .class );
115118 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
116119 mockJenkins (mocked , jenkins );
@@ -120,7 +123,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
120123 }
121124 }
122125
123- @ Test public void resolveOuterView () throws Exception {
126+ @ Test
127+ void resolveOuterView () throws Exception {
124128 Jenkins jenkins = mock (Jenkins .class );
125129 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
126130 mockJenkins (mocked , jenkins );
@@ -130,7 +134,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
130134 }
131135 }
132136
133- @ Test public void ignoreLeadingAndTrailingSlashes () throws Exception {
137+ @ Test
138+ void ignoreLeadingAndTrailingSlashes () throws Exception {
134139 Jenkins jenkins = mock (Jenkins .class );
135140 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
136141 mockJenkins (mocked , jenkins );
@@ -140,7 +145,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
140145 }
141146 }
142147
143- @ Test public void reportNonexistentTopLevelView () throws Exception {
148+ @ Test
149+ void reportNonexistentTopLevelView () {
144150 Jenkins jenkins = mock (Jenkins .class );
145151 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
146152 mockJenkins (mocked , jenkins );
@@ -154,7 +160,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
154160 }
155161 }
156162
157- @ Test public void reportNonexistentNestedView () throws Exception {
163+ @ Test
164+ void reportNonexistentNestedView () {
158165 Jenkins jenkins = mock (Jenkins .class );
159166 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
160167 mockJenkins (mocked , jenkins );
@@ -168,7 +175,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
168175 }
169176 }
170177
171- @ Test public void reportNonexistentInnerView () throws Exception {
178+ @ Test
179+ void reportNonexistentInnerView () {
172180 Jenkins jenkins = mock (Jenkins .class );
173181 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
174182 mockJenkins (mocked , jenkins );
@@ -182,7 +190,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
182190 }
183191 }
184192
185- @ Test public void reportTraversingViewThatIsNotAViewGroup () throws Exception {
193+ @ Test
194+ void reportTraversingViewThatIsNotAViewGroup () {
186195 Jenkins jenkins = mock (Jenkins .class );
187196 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
188197 mockJenkins (mocked , jenkins );
@@ -196,7 +205,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
196205 }
197206 }
198207
199- @ Test public void reportEmptyViewNameRequestAsNull () {
208+ @ Test
209+ void reportEmptyViewNameRequestAsNull () {
200210 Jenkins jenkins = mock (Jenkins .class );
201211 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
202212 mockJenkins (mocked , jenkins );
@@ -205,18 +215,19 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
205215 }
206216 }
207217
208- @ Test public void reportViewSpaceNameRequestAsIAE () {
218+ @ Test
219+ void reportViewSpaceNameRequestAsIAE () {
209220 Jenkins jenkins = mock (Jenkins .class );
210221 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
211222 mockJenkins (mocked , jenkins );
212- final IllegalArgumentException e = assertThrows ("No exception thrown. Expected IllegalArgumentException" ,
213- IllegalArgumentException .class , () -> assertNull (handler .getView (" " )));
223+ final IllegalArgumentException e = assertThrows (IllegalArgumentException .class , () -> assertNull (handler .getView (" " )), "No exception thrown. Expected IllegalArgumentException" );
214224 assertEquals ("No view named inside view Jenkins" , e .getMessage ());
215225 verifyNoInteractions (setter );
216226 }
217227 }
218228
219- @ Test public void reportNullViewAsNPE () {
229+ @ Test
230+ void reportNullViewAsNPE () {
220231 Jenkins jenkins = mock (Jenkins .class );
221232 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
222233 mockJenkins (mocked , jenkins );
@@ -225,7 +236,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
225236 }
226237 }
227238
228- @ Test public void refuseToReadOuterView () throws Exception {
239+ @ Test
240+ void refuseToReadOuterView () {
229241 Jenkins jenkins = mock (Jenkins .class );
230242 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
231243 mockJenkins (mocked , jenkins );
@@ -245,7 +257,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
245257 }
246258 }
247259
248- @ Test public void refuseToReadNestedView () throws Exception {
260+ @ Test
261+ void refuseToReadNestedView () {
249262 Jenkins jenkins = mock (Jenkins .class );
250263 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
251264 mockJenkins (mocked , jenkins );
@@ -264,7 +277,8 @@ public boolean hasPermission2(@NonNull Authentication a, @NonNull Permission p)
264277 }
265278 }
266279
267- @ Test public void refuseToReadInnerView () throws Exception {
280+ @ Test
281+ void refuseToReadInnerView () {
268282 Jenkins jenkins = mock (Jenkins .class );
269283 try (MockedStatic <Jenkins > mocked = mockStatic (Jenkins .class )) {
270284 mockJenkins (mocked , jenkins );
0 commit comments