25
25
26
26
package integration ;
27
27
28
- import org .htmlunit .html .HtmlAnchor ;
29
- import org .htmlunit .html .HtmlPage ;
30
28
import edu .umd .cs .findbugs .annotations .NonNull ;
31
29
import hudson .Extension ;
32
30
import hudson .model .Action ;
42
40
import hudson .views .WeatherColumn ;
43
41
import integration .harness .BasicMultiBranchProject ;
44
42
import integration .harness .BasicMultiBranchProjectFactory ;
45
- import java .io .IOException ;
46
- import java .util .ArrayList ;
47
- import java .util .Arrays ;
48
- import java .util .Collections ;
49
- import java .util .List ;
50
43
import jenkins .branch .Branch ;
51
44
import jenkins .branch .BranchIndexingCause ;
52
45
import jenkins .branch .BranchSource ;
65
58
import jenkins .scm .impl .mock .MockSCMNavigator ;
66
59
import jenkins .scm .impl .mock .MockSCMSource ;
67
60
import jenkins .scm .impl .mock .MockSCMSourceEvent ;
68
- import org .junit .Before ;
69
- import org .junit .ClassRule ;
70
- import org .junit .Test ;
61
+ import org .htmlunit .html .HtmlAnchor ;
62
+ import org .htmlunit .html .HtmlPage ;
63
+ import org .junit .jupiter .api .BeforeAll ;
64
+ import org .junit .jupiter .api .BeforeEach ;
65
+ import org .junit .jupiter .api .Test ;
71
66
import org .jvnet .hudson .test .Issue ;
72
67
import org .jvnet .hudson .test .JenkinsRule ;
68
+ import org .jvnet .hudson .test .junit .jupiter .WithJenkins ;
69
+
70
+ import java .io .IOException ;
71
+ import java .util .ArrayList ;
72
+ import java .util .Arrays ;
73
+ import java .util .Collections ;
74
+ import java .util .List ;
73
75
74
76
import static org .hamcrest .MatcherAssert .assertThat ;
75
77
import static org .hamcrest .Matchers .allOf ;
82
84
import static org .hamcrest .Matchers .notNullValue ;
83
85
import static org .hamcrest .Matchers .nullValue ;
84
86
85
- public class BrandingTest {
87
+ @ WithJenkins
88
+ class BrandingTest {
86
89
87
90
/**
88
91
* All tests in this class only create items and do not affect other global configuration, thus we trade test
89
92
* execution time for the restriction on only touching items.
90
93
*/
91
- @ ClassRule
92
- public static JenkinsRule r = new JenkinsRule ();
94
+ private static JenkinsRule r ;
95
+
96
+ @ BeforeAll
97
+ static void setUp (JenkinsRule rule ) {
98
+ r = rule ;
99
+ }
93
100
94
- @ Before
95
- public void cleanOutAllItems () throws Exception {
101
+ @ BeforeEach
102
+ void setUp () throws Exception {
96
103
for (TopLevelItem i : r .getInstance ().getItems ()) {
97
104
i .delete ();
98
105
}
99
106
}
100
107
101
108
@ Test
102
- public void given_multibranch_when_noSourcesDefined_then_noSourceBrandingPresent () throws Exception {
109
+ void given_multibranch_when_noSourcesDefined_then_noSourceBrandingPresent () throws Exception {
103
110
try (MockSCMController c = MockSCMController .create ()) {
104
111
BasicMultiBranchProject prj = r .jenkins .createProject (BasicMultiBranchProject .class , "foo" );
105
112
prj .setCriteria (null );
@@ -108,7 +115,7 @@ public void given_multibranch_when_noSourcesDefined_then_noSourceBrandingPresent
108
115
}
109
116
110
117
@ Test
111
- public void given_multibranch_when_sourceDefined_then_sourceBrandingPresentAfterIndexing ()
118
+ void given_multibranch_when_sourceDefined_then_sourceBrandingPresentAfterIndexing ()
112
119
throws Exception {
113
120
try (MockSCMController c = MockSCMController .create ()) {
114
121
c .createRepository ("foo" );
@@ -123,7 +130,7 @@ public void given_multibranch_when_sourceDefined_then_sourceBrandingPresentAfter
123
130
}
124
131
125
132
@ Test
126
- public void given_multibranch_when_sourceDefined_then_sourceBrandingPresentAfterSourceEvent ()
133
+ void given_multibranch_when_sourceDefined_then_sourceBrandingPresentAfterSourceEvent ()
127
134
throws Exception {
128
135
try (MockSCMController c = MockSCMController .create ()) {
129
136
c .createRepository ("foo" );
@@ -138,7 +145,7 @@ public void given_multibranch_when_sourceDefined_then_sourceBrandingPresentAfter
138
145
}
139
146
140
147
@ Test
141
- public void given_multibranch_when_branches_then_branchBrandingPresent ()
148
+ void given_multibranch_when_branches_then_branchBrandingPresent ()
142
149
throws Exception {
143
150
try (MockSCMController c = MockSCMController .create ()) {
144
151
c .createRepository ("foo" );
@@ -152,7 +159,7 @@ public void given_multibranch_when_branches_then_branchBrandingPresent()
152
159
}
153
160
154
161
@ Test
155
- public void given_multibranch_when_branches_then_runBrandingPresent ()
162
+ void given_multibranch_when_branches_then_runBrandingPresent ()
156
163
throws Exception {
157
164
try (MockSCMController c = MockSCMController .create ()) {
158
165
c .createRepository ("foo" );
@@ -169,7 +176,7 @@ public void given_multibranch_when_branches_then_runBrandingPresent()
169
176
170
177
@ Test
171
178
@ Issue ("JENKINS-48090" )
172
- public void given_multibranch_when_runBrandingIncludesAdditionalCauses_then_causesMerged () throws Exception {
179
+ void given_multibranch_when_runBrandingIncludesAdditionalCauses_then_causesMerged () throws Exception {
173
180
try (MockSCMController c = MockSCMController .create ()) {
174
181
c .createRepository ("foo" );
175
182
BasicMultiBranchProject prj = r .jenkins .createProject (BasicMultiBranchProject .class , "foo" );
@@ -188,15 +195,15 @@ public void given_multibranch_when_runBrandingIncludesAdditionalCauses_then_caus
188
195
}
189
196
190
197
@ Test
191
- public void given_orgFolder_when_noNavigatorsDefined_then_noNavigatorBrandingPresent () throws Exception {
198
+ void given_orgFolder_when_noNavigatorsDefined_then_noNavigatorBrandingPresent () throws Exception {
192
199
try (MockSCMController c = MockSCMController .create ()) {
193
200
OrganizationFolder prj = r .jenkins .createProject (OrganizationFolder .class , "foo" );
194
201
assertThat (prj .getAction (MockSCMLink .class ), nullValue ());
195
202
}
196
203
}
197
204
198
205
@ Test
199
- public void given_multibranch_when_sourceHasNonSafeNames_then_branchDisplayNameNotMangled () throws Exception {
206
+ void given_multibranch_when_sourceHasNonSafeNames_then_branchDisplayNameNotMangled () throws Exception {
200
207
try (MockSCMController c = MockSCMController .create ()) {
201
208
c .createRepository ("foo" );
202
209
c .createBranch ("foo" , "." );
@@ -258,7 +265,7 @@ public void given_multibranch_when_sourceHasNonSafeNames_then_branchDisplayNameN
258
265
}
259
266
260
267
@ Test
261
- public void given_multibranch_when_sourceHasI18nNames_then_branchDisplayNameNotMangled () throws Exception {
268
+ void given_multibranch_when_sourceHasI18nNames_then_branchDisplayNameNotMangled () throws Exception {
262
269
try (MockSCMController c = MockSCMController .create ()) {
263
270
c .createRepository ("foo" );
264
271
c .createBranch ("foo" ,"特征/新" );
@@ -347,7 +354,7 @@ public void given_multibranch_when_sourceHasI18nNames_then_branchDisplayNameNotM
347
354
}
348
355
349
356
@ Test
350
- public void given_orgFolder_when_navigatorDefined_then_navigatorBrandingPresentAfterIndexing ()
357
+ void given_orgFolder_when_navigatorDefined_then_navigatorBrandingPresentAfterIndexing ()
351
358
throws Exception {
352
359
try (MockSCMController c = MockSCMController .create ()) {
353
360
c .createRepository ("foo" );
@@ -362,7 +369,7 @@ public void given_orgFolder_when_navigatorDefined_then_navigatorBrandingPresentA
362
369
}
363
370
364
371
@ Test
365
- public void given_orgFolderWithI18nRepos_when_indexing_then_repoNamesEncoded ()
372
+ void given_orgFolderWithI18nRepos_when_indexing_then_repoNamesEncoded ()
366
373
throws Exception {
367
374
try (MockSCMController c = MockSCMController .create ()) {
368
375
c .createRepository ("England" );
@@ -437,7 +444,7 @@ public void given_orgFolderWithI18nRepos_when_indexing_then_repoNamesEncoded()
437
444
}
438
445
439
446
@ Test
440
- public void given_orgFolderWithNonSafeRepos_when_indexing_then_repoNamesEncoded ()
447
+ void given_orgFolderWithNonSafeRepos_when_indexing_then_repoNamesEncoded ()
441
448
throws Exception {
442
449
try (MockSCMController c = MockSCMController .create ()) {
443
450
c .createRepository ("a?" );
@@ -482,7 +489,7 @@ public void given_orgFolderWithNonSafeRepos_when_indexing_then_repoNamesEncoded(
482
489
}
483
490
484
491
@ Test
485
- public void given_orgFolder_when_navigatorDefined_then_sourceBrandingPresentAfterIndexing ()
492
+ void given_orgFolder_when_navigatorDefined_then_sourceBrandingPresentAfterIndexing ()
486
493
throws Exception {
487
494
try (MockSCMController c = MockSCMController .create ()) {
488
495
c .createRepository ("foo" );
@@ -497,7 +504,7 @@ public void given_orgFolder_when_navigatorDefined_then_sourceBrandingPresentAfte
497
504
}
498
505
499
506
@ Test
500
- public void given_orgFolder_when_navigatorDefined_then_branchBrandingPresentAfterIndexing ()
507
+ void given_orgFolder_when_navigatorDefined_then_branchBrandingPresentAfterIndexing ()
501
508
throws Exception {
502
509
try (MockSCMController c = MockSCMController .create ()) {
503
510
c .createRepository ("foo" );
@@ -513,7 +520,7 @@ public void given_orgFolder_when_navigatorDefined_then_branchBrandingPresentAfte
513
520
}
514
521
515
522
@ Test
516
- public void given_orgFolder_when_navigatorDefined_then_revisionBrandingPresentAfterIndexing ()
523
+ void given_orgFolder_when_navigatorDefined_then_revisionBrandingPresentAfterIndexing ()
517
524
throws Exception {
518
525
try (MockSCMController c = MockSCMController .create ()) {
519
526
c .createRepository ("foo" );
@@ -529,7 +536,7 @@ public void given_orgFolder_when_navigatorDefined_then_revisionBrandingPresentAf
529
536
}
530
537
531
538
@ Test
532
- public void given_multibranch_when_decoratedSourceDefined_then_descriptionPresentAfterIndexing ()
539
+ void given_multibranch_when_decoratedSourceDefined_then_descriptionPresentAfterIndexing ()
533
540
throws Exception {
534
541
try (MockSCMController c = MockSCMController .create ()) {
535
542
c .createRepository ("foo" );
@@ -545,7 +552,7 @@ public void given_multibranch_when_decoratedSourceDefined_then_descriptionPresen
545
552
}
546
553
547
554
@ Test
548
- public void given_multibranch_when_decoratedSourceDefined_then_displayNamePresentAfterIndexing ()
555
+ void given_multibranch_when_decoratedSourceDefined_then_displayNamePresentAfterIndexing ()
549
556
throws Exception {
550
557
try (MockSCMController c = MockSCMController .create ()) {
551
558
c .createRepository ("foo" );
@@ -564,7 +571,7 @@ public void given_multibranch_when_decoratedSourceDefined_then_displayNamePresen
564
571
}
565
572
566
573
@ Test
567
- public void given_orgFolder_when_decoratedSourceDefined_then_descriptionLinkPresentAfterIndexing ()
574
+ void given_orgFolder_when_decoratedSourceDefined_then_descriptionLinkPresentAfterIndexing ()
568
575
throws Exception {
569
576
try (MockSCMController c = MockSCMController .create ()) {
570
577
c .createRepository ("foo" );
@@ -588,7 +595,7 @@ public void given_orgFolder_when_decoratedSourceDefined_then_descriptionLinkPres
588
595
}
589
596
590
597
@ Test
591
- public void given_multibranch_when_decoratedSourceDefined_then_folderIconPresentAfterIndexing ()
598
+ void given_multibranch_when_decoratedSourceDefined_then_folderIconPresentAfterIndexing ()
592
599
throws Exception {
593
600
try (MockSCMController c = MockSCMController .create ()) {
594
601
c .createRepository ("foo" );
@@ -604,7 +611,7 @@ public void given_multibranch_when_decoratedSourceDefined_then_folderIconPresent
604
611
}
605
612
606
613
@ Test
607
- public void given_orgFolder_when_decoratedOrganizationDefined_then_folderIconPresentAfterIndexing ()
614
+ void given_orgFolder_when_decoratedOrganizationDefined_then_folderIconPresentAfterIndexing ()
608
615
throws Exception {
609
616
try (MockSCMController c = MockSCMController .create ()) {
610
617
c .createRepository ("foo" );
@@ -620,7 +627,7 @@ public void given_orgFolder_when_decoratedOrganizationDefined_then_folderIconPre
620
627
}
621
628
622
629
@ Test
623
- public void given_orgFolder_when_decoratedOrganizationDefined_then_displayNamePresentAfterIndexing ()
630
+ void given_orgFolder_when_decoratedOrganizationDefined_then_displayNamePresentAfterIndexing ()
624
631
throws Exception {
625
632
try (MockSCMController c = MockSCMController .create ()) {
626
633
c .createRepository ("foo" );
@@ -636,7 +643,7 @@ public void given_orgFolder_when_decoratedOrganizationDefined_then_displayNamePr
636
643
}
637
644
638
645
@ Test
639
- public void given_orgFolder_when_decoratedOrganizationDefined_then_descriptionLinkPresentAfterIndexing ()
646
+ void given_orgFolder_when_decoratedOrganizationDefined_then_descriptionLinkPresentAfterIndexing ()
640
647
throws Exception {
641
648
try (MockSCMController c = MockSCMController .create ()) {
642
649
c .createRepository ("foo" );
0 commit comments