33import static net .uaznia .lukanus .hudson .plugins .gitparameter .Constants .DEFAULT_VALUE ;
44import static net .uaznia .lukanus .hudson .plugins .gitparameter .Constants .NAME ;
55import static net .uaznia .lukanus .hudson .plugins .gitparameter .Constants .PT_REVISION ;
6- import static org .junit .Assert .assertEquals ;
7- import static org .junit .Assert .assertTrue ;
6+ import static org .junit .jupiter . api . Assertions .assertEquals ;
7+ import static org .junit .jupiter . api . Assertions .assertTrue ;
88import static org .mockito .Mockito .mock ;
99import static org .mockito .Mockito .when ;
1010
1313import java .util .Map ;
1414import java .util .regex .Matcher ;
1515import net .sf .json .JSONObject ;
16- import org .junit .Test ;
16+ import org .junit .jupiter . api . Test ;
1717import org .kohsuke .stapler .StaplerRequest2 ;
1818
1919/**
20- * This test don't use jenkis rule
20+ * This test don't use jenkins rule
2121 */
22- public class BasicTests {
22+ class BasicTests {
23+
2324 /**
2425 * Test of createValue method, of class GitParameterDefinition.
2526 */
2627 @ Test
27- public void testCreateValue_StaplerRequest2 () {
28+ void testCreateValue_StaplerRequest2 () {
2829 GitParameterDefinition instance = new GitParameterDefinition (
2930 NAME ,
3031 PT_REVISION ,
@@ -41,25 +42,25 @@ public void testCreateValue_StaplerRequest2() {
4142 StaplerRequest2 request = mock (StaplerRequest2 .class );
4243 ParameterValue result = instance .createValue (request );
4344
44- assertEquals (result , new GitParameterValue (NAME , DEFAULT_VALUE ));
45+ assertEquals (new GitParameterValue (NAME , DEFAULT_VALUE ), result );
4546 }
4647
4748 @ Test
48- public void matchesWithBitbucketPullRequestRefs () {
49+ void matchesWithBitbucketPullRequestRefs () {
4950 Matcher matcher = Consts .PULL_REQUEST_REFS_PATTERN .matcher ("refs/pull-requests/186/from" );
5051 assertTrue (matcher .find ());
51- assertEquals (matcher .group (1 ), "186" );
52+ assertEquals ("186" , matcher .group (1 ));
5253 }
5354
5455 @ Test
55- public void matchesWithGithubPullRequestRefs () {
56+ void matchesWithGithubPullRequestRefs () {
5657 Matcher matcher = Consts .PULL_REQUEST_REFS_PATTERN .matcher ("refs/pull/45/head" );
5758 assertTrue (matcher .find ());
58- assertEquals (matcher .group (1 ), "45" );
59+ assertEquals ("45" , matcher .group (1 ));
5960 }
6061
6162 @ Test
62- public void testCreateValue_StaplerRequest2_ValueInRequest () {
63+ void testCreateValue_StaplerRequest2_ValueInRequest () {
6364 GitParameterDefinition instance = new GitParameterDefinition (
6465 NAME ,
6566 PT_REVISION ,
@@ -77,11 +78,11 @@ public void testCreateValue_StaplerRequest2_ValueInRequest() {
7778 when (request .getParameterValues (instance .getName ())).thenReturn (new String [] {"master" });
7879 ParameterValue result = instance .createValue (request );
7980
80- assertEquals (result , new GitParameterValue (NAME , "master" ));
81+ assertEquals (new GitParameterValue (NAME , "master" ), result );
8182 }
8283
8384 @ Test
84- public void testConstructorInitializesTagFilterToAsteriskWhenNull () {
85+ void testConstructorInitializesTagFilterToAsteriskWhenNull () {
8586 GitParameterDefinition instance = new GitParameterDefinition (
8687 NAME ,
8788 PT_REVISION ,
@@ -99,7 +100,7 @@ public void testConstructorInitializesTagFilterToAsteriskWhenNull() {
99100 }
100101
101102 @ Test
102- public void testConstructorInitializesTagFilterToAsteriskWhenWhitespace () {
103+ void testConstructorInitializesTagFilterToAsteriskWhenWhitespace () {
103104 GitParameterDefinition instance = new GitParameterDefinition (
104105 NAME ,
105106 PT_REVISION ,
@@ -117,7 +118,7 @@ public void testConstructorInitializesTagFilterToAsteriskWhenWhitespace() {
117118 }
118119
119120 @ Test
120- public void testConstructorInitializesTagFilterToAsteriskWhenEmpty () {
121+ void testConstructorInitializesTagFilterToAsteriskWhenEmpty () {
121122 GitParameterDefinition instance = new GitParameterDefinition (
122123 NAME ,
123124 PT_REVISION ,
@@ -135,7 +136,7 @@ public void testConstructorInitializesTagFilterToAsteriskWhenEmpty() {
135136 }
136137
137138 @ Test
138- public void testConstructorInitializesTagToGivenValueWhenNotNullOrWhitespace () {
139+ void testConstructorInitializesTagToGivenValueWhenNotNullOrWhitespace () {
139140 GitParameterDefinition instance = new GitParameterDefinition (
140141 NAME ,
141142 PT_REVISION ,
@@ -156,7 +157,7 @@ public void testConstructorInitializesTagToGivenValueWhenNotNullOrWhitespace() {
156157 * Test of createValue method, of class GitParameterDefinition.
157158 */
158159 @ Test
159- public void testCreateValue_StaplerRequest2_JSONObject () {
160+ void testCreateValue_StaplerRequest2_JSONObject () {
160161 System .out .println ("createValue" );
161162 StaplerRequest2 request = mock (StaplerRequest2 .class );
162163
@@ -181,24 +182,14 @@ public void testCreateValue_StaplerRequest2_JSONObject() {
181182
182183 ParameterValue result = instance .createValue (request , jO );
183184
184- assertEquals (result , new GitParameterValue ("Git_param_name" , "Git_param_value" ));
185- }
186-
187- /**
188- * Test of getDefaultParameterValue method, of class GitParameterDefinition.
189- */
190- @ Test
191- public void testGetDefaultParameterValue () {
192-
193- // TODO review the generated test code and remove the default call to fail.
194- // fail("The test case is a prototype.");
185+ assertEquals (new GitParameterValue ("Git_param_name" , "Git_param_value" ), result );
195186 }
196187
197188 /**
198189 * Test of getType method, of class GitParameterDefinition.
199190 */
200191 @ Test
201- public void testGetParameterType () {
192+ void testGetParameterType () {
202193 String expResult = PT_REVISION ;
203194 GitParameterDefinition instance = new GitParameterDefinition (
204195 NAME ,
@@ -224,7 +215,7 @@ public void testGetParameterType() {
224215 * Test of setType method, of class GitParameterDefinition.
225216 */
226217 @ Test
227- public void testSetParameterType () {
218+ void testSetParameterType () {
228219 String expResult = PT_REVISION ;
229220 GitParameterDefinition instance = new GitParameterDefinition (
230221 NAME ,
@@ -245,7 +236,7 @@ public void testSetParameterType() {
245236 }
246237
247238 @ Test
248- public void testWrongType () {
239+ void testWrongType () {
249240 GitParameterDefinition instance = new GitParameterDefinition (
250241 NAME ,
251242 "asdf" ,
@@ -267,7 +258,7 @@ public void testWrongType() {
267258 * Test of getDefaultValue method, of class GitParameterDefinition.
268259 */
269260 @ Test
270- public void testGetDefaultValue () {
261+ void testGetDefaultValue () {
271262 System .out .println ("getDefaultValue" );
272263 String expResult = DEFAULT_VALUE ;
273264
@@ -291,7 +282,7 @@ public void testGetDefaultValue() {
291282 * Test of setDefaultValue method, of class GitParameterDefinition.
292283 */
293284 @ Test
294- public void testSetDefaultValue () {
285+ void testSetDefaultValue () {
295286 System .out .println ("getDefaultValue" );
296287 String expResult = DEFAULT_VALUE ;
297288
@@ -312,10 +303,4 @@ public void testSetDefaultValue() {
312303 String result = instance .getDefaultValue ();
313304 assertEquals (expResult , result );
314305 }
315-
316- /**
317- * Test of generateContents method, of class GitParameterDefinition.
318- */
319- @ Test
320- public void testGenerateContents () {}
321306}
0 commit comments