5555import static org .hamcrest .Matchers .startsWith ;
5656import static org .junit .Assert .*;
5757import static org .mockito .ArgumentMatchers .anyInt ;
58+ import static org .mockito .ArgumentMatchers .anyString ;
5859import static org .mockito .ArgumentMatchers .any ;
5960import static org .mockito .ArgumentMatchers .eq ;
6061import static org .mockito .Mockito .atLeastOnce ;
@@ -98,7 +99,7 @@ public void provisionSlaveOnDemand() throws Exception {
9899
99100 Openstack os = cloud .getOpenstack ();
100101 verify (os , atLeastOnce ()).getRunningNodes ();
101- verify (os , times (2 )).bootAndWaitActive (any (ServerCreateBuilder .class ), any ( Integer . class ));
102+ verify (os , times (2 )).bootAndWaitActive (any (ServerCreateBuilder .class ), anyInt ( ));
102103 verify (os , times (2 )).assignFloatingIp (any (Server .class ), eq ("custom" ));
103104 verify (os , atLeastOnce ()).destroyServer (any (Server .class ));
104105
@@ -111,7 +112,7 @@ public void abortProvisioningWhenOpenstackFails() throws Exception {
111112 JCloudsSlaveTemplate template = j .dummySlaveTemplate ("label" );
112113 JCloudsCloud cloud = j .dummyCloud (template );
113114 Openstack os = cloud .getOpenstack ();
114- when (os .bootAndWaitActive (any (ServerCreateBuilder .class ), any ( Integer . class ))).thenThrow (new Openstack .ActionFailed ("It is broken, alright!" ));
115+ when (os .bootAndWaitActive (any (ServerCreateBuilder .class ), anyInt ( ))).thenThrow (new Openstack .ActionFailed ("It is broken, alright!" ));
115116
116117 FreeStyleProject p = j .createFreeStyleProject ();
117118 p .setAssignedLabel (Label .get ("label" ));
@@ -120,7 +121,7 @@ public void abortProvisioningWhenOpenstackFails() throws Exception {
120121 Thread .sleep (1000 );
121122 assertFalse (started .isDone ());
122123
123- verify (os , atLeastOnce ()).bootAndWaitActive (any (ServerCreateBuilder .class ), any ( Integer . class ));
124+ verify (os , atLeastOnce ()).bootAndWaitActive (any (ServerCreateBuilder .class ), anyInt ( ));
124125 }
125126
126127 @ Test @ Issue ("https://github.com/jenkinsci/openstack-cloud-plugin/issues/37" )
@@ -129,8 +130,8 @@ public void detectBootTimingOut() {
129130 final JCloudsCloud cloud = j .dummyCloud (template );
130131 Openstack os = cloud .getOpenstack ();
131132 Server server = j .mockServer ().name ("provisioned" ).status (Server .Status .BUILD ).get ();
132- when (os .bootAndWaitActive (any (ServerCreateBuilder .class ), any ( Integer . class ))).thenCallRealMethod ();
133- when (os ._bootAndWaitActive (any (ServerCreateBuilder .class ), any ( Integer . class ))).thenReturn (server );
133+ when (os .bootAndWaitActive (any (ServerCreateBuilder .class ), anyInt ( ))).thenCallRealMethod ();
134+ when (os ._bootAndWaitActive (any (ServerCreateBuilder .class ), anyInt ( ))).thenReturn (server );
134135 when (os .updateInfo (eq (server ))).thenReturn (server );
135136
136137 try {
@@ -160,7 +161,7 @@ public void verifyOptionsPropagatedToLauncher() throws Exception {
160161 assertEquals (slave .getPublicAddress (), launcher .getHost ());
161162 assertEquals ("credid" , launcher .getCredentialsId ());
162163 //noinspection deprecation
163- assertEquals ("java" , launcher .getJavaPath ()); // https://github.com/jenkinsci/ssh-slaves-plugin/commit/9d25b12b1340e00d63a069f54c1b2361f745b6fc#commitcomment-49501649
164+ assertEquals ("java" , launcher .getHost ()); // https://github.com/jenkinsci/ssh-slaves-plugin/commit/9d25b12b1340e00d63a069f54c1b2361f745b6fc#commitcomment-49501649
164165 assertEquals (expected .getJvmOptions (), launcher .getJvmOptions ());
165166 assertEquals (10 , (int ) slave .getSlaveOptions ().getRetentionTime ());
166167
@@ -316,7 +317,7 @@ public void timeoutProvisioning() throws Exception {
316317 when (os ._bootAndWaitActive (any (ServerCreateBuilder .class ), anyInt ())).thenReturn (null ); // Timeout
317318 when (os .bootAndWaitActive (any (ServerCreateBuilder .class ), anyInt ())).thenCallRealMethod ();
318319 Server server = mock (Server .class );
319- when (os .getServersByName (any ( String . class ))).thenReturn (Collections .singletonList (server ));
320+ when (os .getServersByName (anyString ( ))).thenReturn (Collections .singletonList (server ));
320321
321322 for (NodeProvisioner .PlannedNode pn : c .provision (Label .get ("label" ), 1 )) {
322323 try {
@@ -479,7 +480,6 @@ public void failIfNoAccessIpFound() {
479480 private void verifyPreferredAddressUsed (String expectedAddress , Collection <NetworkAddress > addresses ) throws Exception {
480481 CloudStatistics cs = CloudStatistics .get ();
481482 assertThat (cs .getActivities (), Matchers .iterableWithSize (0 ));
482-
483483 j .autoconnectJnlpSlaves ();
484484 JCloudsCloud cloud = j .configureSlaveProvisioning (j .dummyCloud (j .dummySlaveTemplate ("label" )), addresses );
485485
0 commit comments