diff --git a/pom.xml b/pom.xml
index edecc96..0e59368 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.metricshub
oss-parent
- 2
+ 4
winrm-java
diff --git a/src/test/java/org/metricshub/winrm/command/WinRMCommandExecutorTest.java b/src/test/java/org/metricshub/winrm/command/WinRMCommandExecutorTest.java
index 33c5645..df46bf3 100644
--- a/src/test/java/org/metricshub/winrm/command/WinRMCommandExecutorTest.java
+++ b/src/test/java/org/metricshub/winrm/command/WinRMCommandExecutorTest.java
@@ -21,13 +21,11 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
-import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.metricshub.winrm.WindowsRemoteCommandResult;
-import org.metricshub.winrm.WindowsRemoteExecutor;
import org.metricshub.winrm.WindowsRemoteProcessUtils;
import org.metricshub.winrm.service.WinRMEndpoint;
import org.metricshub.winrm.service.WinRMService;
@@ -201,22 +199,20 @@ void testExecute() throws Exception {
.thenReturn("launch remote/localFile");
final SmbTempShare smbTempShare = mock(SmbTempShare.class);
- final WindowsRemoteExecutor windowsRemoteExecutor = mock(WindowsRemoteExecutor.class);
+ final WinRMService winRMService = mock(WinRMService.class);
mockedSmbTempShare
.when(() -> SmbTempShare.createInstance(any(WinRMEndpoint.class), anyLong(), isNull(), isNull()))
.thenReturn(smbTempShare);
doNothing().when(smbTempShare).checkConnectedFirst();
- doReturn(windowsRemoteExecutor).when(smbTempShare).getWindowsRemoteExecutor();
+ doReturn(winRMService).when(smbTempShare).getWindowsRemoteExecutor();
doReturn("\\\\2001-db8--85b-3c51-f5ff-ffdb.ipv6-literal.net\\SEN_ShareFor_PC-TEST$")
.when(smbTempShare)
.getUncSharePath();
doReturn("Windows\\Temp\\SEN_ShareFor_TEST$").when(smbTempShare).getRemotePath();
- doReturn(expected)
- .when(windowsRemoteExecutor)
- .executeCommand(anyString(), isNull(), any(Charset.class), anyLong());
+ doReturn(expected).when(winRMService).executeCommand(anyString(), isNull(), eq(UTF_8), anyLong());
assertEquals(
expected,
diff --git a/src/test/java/org/metricshub/winrm/service/client/WinRMInvocationHandlerTest.java b/src/test/java/org/metricshub/winrm/service/client/WinRMInvocationHandlerTest.java
index 8548efe..cef39eb 100644
--- a/src/test/java/org/metricshub/winrm/service/client/WinRMInvocationHandlerTest.java
+++ b/src/test/java/org/metricshub/winrm/service/client/WinRMInvocationHandlerTest.java
@@ -20,6 +20,7 @@
import static org.metricshub.winrm.service.client.auth.AuthenticationEnum.NTLM;
import static org.metricshub.winrm.service.client.auth.kerberos.KerberosUtils.createCredentials;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
@@ -36,7 +37,6 @@
import jakarta.xml.ws.WebServiceException;
import jakarta.xml.ws.soap.SOAPFaultException;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.util.LinkedList;
@@ -51,7 +51,6 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.metricshub.winrm.Utils;
import org.metricshub.winrm.exceptions.KerberosCredentialsException;
@@ -63,6 +62,10 @@
import org.metricshub.winrm.service.client.auth.AuthenticationEnum;
import org.metricshub.winrm.service.client.auth.kerberos.KerberosUtils;
import org.metricshub.winrm.service.client.auth.ntlm.NTCredentialsWithEncryption;
+import org.metricshub.winrm.service.shell.Receive;
+import org.metricshub.winrm.service.shell.ReceiveResponse;
+import org.metricshub.winrm.service.wsman.Locale;
+import org.metricshub.winrm.service.wsman.SelectorSetType;
import org.mockito.MockedStatic;
class WinRMInvocationHandlerTest {
@@ -100,9 +103,29 @@ class WinRMInvocationHandlerTest {
private static final Client WS_CLIENT = mock(Client.class);
private static final KerberosCredentials KERBEROS_CREDENTIALS = mock(KerberosCredentials.class);
private static final NTCredentials NTC_CREDENTIALS = mock(NTCredentialsWithEncryption.class);
- private static final Method METHOD = mock(Method.class);
+ private static final Method RECEIVE_METHOD;
+ private static final Object[] RECEIVE_ARGS;
private static final List AUTHENTICATIONS = singletonList(NTLM);
+ static {
+ try {
+ RECEIVE_METHOD =
+ WinRMWebService.class.getMethod(
+ "receive",
+ Receive.class,
+ String.class,
+ int.class,
+ String.class,
+ Locale.class,
+ SelectorSetType.class
+ );
+ RECEIVE_ARGS =
+ new Object[] { new Receive(), "resourceURI", 512000, "PT60S", new Locale(), new SelectorSetType() };
+ } catch (ReflectiveOperationException e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
+
private static final Queue AUTHENTICATIONS_KERBEROS_NTLM = asList(KERBEROS, NTLM)
.stream()
.collect(Collectors.toCollection(LinkedList::new));
@@ -121,7 +144,7 @@ class WinRMInvocationHandlerTest {
private static final Object PROXY = new Object();
private static final Object[] ARGS = {};
- private static final Object RESULT = new Object();
+ private static final ReceiveResponse RESULT = mock(ReceiveResponse.class);
/** to neutralize Utils.sleep */
private static final MockedStatic MOCKED_UTILS = mockStatic(Utils.class);
@@ -213,14 +236,14 @@ static void closeMockStatics() {
MOCKED_WIN_RM_INVOCATION_HANDLER.close();
}
- @BeforeEach
- void initMock() {
- doReturn("Receive").when(METHOD).getName();
- }
-
@AfterEach
void resetMocks() {
- reset(METHOD);
+ reset(WIN_RM_WS);
+ }
+
+ private static void verifyReceiveInvoked(final int times) {
+ verify(WIN_RM_WS, times(times))
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
}
@Test
@@ -288,14 +311,14 @@ void testInvoke() throws Throwable {
)
.doReturn(RESULT)
.when(winRMInvocationHandler)
- .invokeMethod(METHOD, ARGS);
+ .invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS);
mockedKerberosUtils
.when(() -> KerberosUtils.createCredentials("JohnDoe", "pwd".toCharArray(), null))
.thenReturn(KERBEROS_CREDENTIALS);
- assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, METHOD, ARGS));
- verify(winRMInvocationHandler, times(2)).invoke(PROXY, METHOD, ARGS);
+ assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS));
+ verify(winRMInvocationHandler, times(2)).invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS);
}
// check KERBEROS authentication failure like a ticket validity expiration with an exception and no more retry
@@ -313,7 +336,7 @@ void testInvoke() throws Throwable {
)
.doReturn(RESULT)
.when(winRMInvocationHandler)
- .invokeMethod(METHOD, ARGS);
+ .invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS);
doReturn(false).when(winRMInvocationHandler).continueToRetry();
@@ -321,8 +344,11 @@ void testInvoke() throws Throwable {
.when(() -> KerberosUtils.createCredentials("JohnDoe", "pwd".toCharArray(), null))
.thenThrow(KerberosCredentialsException.class);
- assertThrows(KerberosCredentialsException.class, () -> winRMInvocationHandler.invoke(PROXY, METHOD, ARGS));
- verify(winRMInvocationHandler, times(1)).invoke(PROXY, METHOD, ARGS);
+ assertThrows(
+ KerberosCredentialsException.class,
+ () -> winRMInvocationHandler.invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS)
+ );
+ verify(winRMInvocationHandler, times(1)).invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS);
}
// check KERBEROS authentication failure like a ticket validity expiration with an exception and a retry
@@ -340,7 +366,7 @@ void testInvoke() throws Throwable {
)
.doReturn(RESULT)
.when(winRMInvocationHandler)
- .invokeMethod(METHOD, ARGS);
+ .invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS);
doReturn(true).when(winRMInvocationHandler).continueToRetry();
@@ -348,8 +374,8 @@ void testInvoke() throws Throwable {
.when(() -> KerberosUtils.createCredentials("JohnDoe", "pwd".toCharArray(), null))
.thenThrow(KerberosCredentialsException.class);
- assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, METHOD, ARGS));
- verify(winRMInvocationHandler, times(2)).invoke(PROXY, METHOD, ARGS);
+ assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS));
+ verify(winRMInvocationHandler, times(2)).invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS);
}
// check retry
@@ -363,12 +389,12 @@ void testInvoke() throws Throwable {
doThrow(new RetryAuthenticationException(new SOAPFaultException(SOAPFactory.newInstance().createFault())))
.doReturn(RESULT)
.when(winRMInvocationHandler)
- .invokeMethod(METHOD, ARGS);
+ .invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS);
doReturn(true, false).when(winRMInvocationHandler).continueToRetry();
- assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, METHOD, ARGS));
- verify(winRMInvocationHandler, times(2)).invoke(PROXY, METHOD, ARGS);
+ assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS));
+ verify(winRMInvocationHandler, times(2)).invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS);
}
// check KO no retries KERBEROS over HTTP
@@ -381,16 +407,16 @@ void testInvoke() throws Throwable {
doThrow(new RetryAuthenticationException(new SOAPFaultException(SOAPFactory.newInstance().createFault())))
.when(winRMInvocationHandler)
- .invokeMethod(METHOD, ARGS);
+ .invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS);
doReturn(false).when(winRMInvocationHandler).continueToRetry();
final RuntimeException exception = assertThrows(
RuntimeException.class,
- () -> winRMInvocationHandler.invoke(PROXY, METHOD, ARGS)
+ () -> winRMInvocationHandler.invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS)
);
assertEquals("KERBEROS with encryption over HTTP is not implemented.", exception.getMessage());
- verify(winRMInvocationHandler, times(1)).invoke(PROXY, METHOD, ARGS);
+ verify(winRMInvocationHandler, times(1)).invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS);
}
// check KO no retries
@@ -407,12 +433,12 @@ void testInvoke() throws Throwable {
)
)
.when(winRMInvocationHandler)
- .invokeMethod(METHOD, ARGS);
+ .invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS);
doReturn(false).when(winRMInvocationHandler).continueToRetry();
- assertThrows(RuntimeException.class, () -> winRMInvocationHandler.invoke(PROXY, METHOD, ARGS));
- verify(winRMInvocationHandler, times(1)).invoke(PROXY, METHOD, ARGS);
+ assertThrows(RuntimeException.class, () -> winRMInvocationHandler.invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS));
+ verify(winRMInvocationHandler, times(1)).invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS);
}
// check OK without retry
@@ -421,10 +447,10 @@ void testInvoke() throws Throwable {
new WinRMInvocationHandler(WIN_RM_ENDPOINT, BUS, TIMEOUT, null, null, AUTHENTICATIONS)
);
- doReturn(RESULT).when(winRMInvocationHandler).invokeMethod(METHOD, ARGS);
+ doReturn(RESULT).when(winRMInvocationHandler).invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS);
- assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, METHOD, ARGS));
- verify(winRMInvocationHandler, times(1)).invoke(PROXY, METHOD, ARGS);
+ assertEquals(RESULT, winRMInvocationHandler.invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS));
+ verify(winRMInvocationHandler, times(1)).invoke(PROXY, RECEIVE_METHOD, RECEIVE_ARGS);
}
}
@@ -495,13 +521,16 @@ void testInvokeMethodSOAPFaultExceptionKerberosRetry() throws Exception {
authentications
);
- doThrow(new InvocationTargetException(new SOAPFaultException(SOAPFactory.newInstance().createFault())))
- .when(METHOD)
- .invoke(WIN_RM_WS, ARGS);
+ doThrow(new SOAPFaultException(SOAPFactory.newInstance().createFault()))
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
- assertThrows(RetryAuthenticationException.class, () -> winRMInvocationHandler.invokeMethod(METHOD, ARGS));
+ assertThrows(
+ RetryAuthenticationException.class,
+ () -> winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS)
+ );
- verify(METHOD, times(1)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(1);
}
@Test
@@ -515,13 +544,13 @@ void testInvokeMethodSOAPFaultExceptionKO() throws Exception {
AUTHENTICATIONS
);
- doThrow(new InvocationTargetException(new SOAPFaultException(SOAPFactory.newInstance().createFault())))
- .when(METHOD)
- .invoke(WIN_RM_WS, ARGS);
+ doThrow(new SOAPFaultException(SOAPFactory.newInstance().createFault()))
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
- assertThrows(SOAPFaultException.class, () -> winRMInvocationHandler.invokeMethod(METHOD, ARGS));
+ assertThrows(SOAPFaultException.class, () -> winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS));
- verify(METHOD, times(1)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(1);
}
@Test
@@ -535,16 +564,18 @@ void testInvokeMethodNotWebServiceExceptionNoRetryKO() throws Exception {
AUTHENTICATIONS
);
- doThrow(new InvocationTargetException(new IllegalArgumentException())).when(METHOD).invoke(WIN_RM_WS, ARGS);
+ doThrow(new IllegalArgumentException())
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
final IllegalStateException exception = assertThrows(
IllegalStateException.class,
- () -> winRMInvocationHandler.invokeMethod(METHOD, ARGS)
+ () -> winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS)
);
- assertEquals("Failure when calling Receive", exception.getMessage());
+ assertTrue(exception.getMessage().startsWith("Failure when calling receive"));
- verify(METHOD, times(1)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(1);
}
@Test
@@ -558,16 +589,18 @@ void testInvokeMethodWebServiceExceptionNotIOExceptionNoRetryKO() throws Excepti
AUTHENTICATIONS
);
- doThrow(new InvocationTargetException(new WebServiceException())).when(METHOD).invoke(WIN_RM_WS, ARGS);
+ doThrow(new WebServiceException())
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
final RuntimeException exception = assertThrows(
RuntimeException.class,
- () -> winRMInvocationHandler.invokeMethod(METHOD, ARGS)
+ () -> winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS)
);
- assertEquals("Exception occurred while making WinRM WebService call Receive", exception.getMessage());
+ assertTrue(exception.getMessage().startsWith("Exception occurred while making WinRM WebService call receive"));
- verify(METHOD, times(1)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(1);
}
@Test
@@ -583,22 +616,20 @@ void testInvokeMethodAuthorizationLoopRetryKerberos() throws Exception {
authentications
);
- doThrow(
- new InvocationTargetException(new WebServiceException(new IOException("Authorization loop detected on Conduit")))
- )
- .when(METHOD)
- .invoke(WIN_RM_WS, ARGS);
+ doThrow(new WebServiceException(new IOException("Authorization loop detected on Conduit")))
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
final RetryTgtExpirationException exception = assertThrows(
RetryTgtExpirationException.class,
- () -> winRMInvocationHandler.invokeMethod(METHOD, ARGS)
+ () -> winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS)
);
final Throwable cause = exception.getCause();
assertTrue(cause instanceof RuntimeException);
assertEquals("Authentication error on http://host:5985/wsman with user name \"JohnDoe\"", cause.getMessage());
- verify(METHOD, times(1)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(1);
}
@Test
@@ -612,22 +643,20 @@ void testInvokeMethodAuthorizationLoopRetryCredentials() throws Exception {
AUTHENTICATIONS
);
- doThrow(
- new InvocationTargetException(new WebServiceException(new IOException("Authorization loop detected on Conduit")))
- )
- .when(METHOD)
- .invoke(WIN_RM_WS, ARGS);
+ doThrow(new WebServiceException(new IOException("Authorization loop detected on Conduit")))
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
final RetryAuthenticationException exception = assertThrows(
RetryAuthenticationException.class,
- () -> winRMInvocationHandler.invokeMethod(METHOD, ARGS)
+ () -> winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS)
);
final Throwable cause = exception.getCause();
assertTrue(cause instanceof RuntimeException);
assertEquals("Authentication error on http://host:5985/wsman with user name \"JohnDoe\"", cause.getMessage());
- verify(METHOD, times(1)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(1);
}
@Test
@@ -641,21 +670,22 @@ void testInvokeMethod3RetriesKO() throws Exception {
AUTHENTICATIONS
);
- doThrow(new InvocationTargetException(new WebServiceException(new IOException())))
- .doThrow(new InvocationTargetException(new WebServiceException(new IOException())))
- .doThrow(new InvocationTargetException(new WebServiceException(new IOException())))
+ doThrow(new WebServiceException(new IOException()))
+ .doThrow(new WebServiceException(new IOException()))
+ .doThrow(new WebServiceException(new IOException()))
.doReturn(RESULT)
- .when(METHOD)
- .invoke(WIN_RM_WS, ARGS);
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
final RuntimeException exception = assertThrows(
RuntimeException.class,
- () -> winRMInvocationHandler.invokeMethod(METHOD, ARGS)
+ () -> winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS)
);
- assertEquals("failed task \"Receive\" after 3 attempts", exception.getMessage());
+ assertTrue(exception.getMessage().startsWith("failed task \"receive"));
+ assertTrue(exception.getMessage().endsWith("after 3 attempts"));
- verify(METHOD, times(3)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(3);
}
@Test
@@ -669,11 +699,13 @@ void testInvokeMethodOK() throws Exception {
AUTHENTICATIONS
);
- doReturn(RESULT).when(METHOD).invoke(WIN_RM_WS, ARGS);
+ doReturn(RESULT)
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
- assertEquals(RESULT, winRMInvocationHandler.invokeMethod(METHOD, ARGS));
+ assertEquals(RESULT, winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS));
- verify(METHOD, times(1)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(1);
}
@Test
@@ -687,14 +719,14 @@ void testInvokeMethod1RetryOK() throws Exception {
AUTHENTICATIONS
);
- doThrow(new InvocationTargetException(new WebServiceException(new IOException())))
+ doThrow(new WebServiceException(new IOException()))
.doReturn(RESULT)
- .when(METHOD)
- .invoke(WIN_RM_WS, ARGS);
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
- assertEquals(RESULT, winRMInvocationHandler.invokeMethod(METHOD, ARGS));
+ assertEquals(RESULT, winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS));
- verify(METHOD, times(2)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(2);
}
@Test
@@ -708,15 +740,15 @@ void testInvokeMethod2RetriesOK() throws Exception {
AUTHENTICATIONS
);
- doThrow(new InvocationTargetException(new WebServiceException(new IOException())))
- .doThrow(new InvocationTargetException(new WebServiceException(new IOException())))
+ doThrow(new WebServiceException(new IOException()))
+ .doThrow(new WebServiceException(new IOException()))
.doReturn(RESULT)
- .when(METHOD)
- .invoke(WIN_RM_WS, ARGS);
+ .when(WIN_RM_WS)
+ .receive(any(Receive.class), anyString(), anyInt(), anyString(), any(Locale.class), any(SelectorSetType.class));
- assertEquals(RESULT, winRMInvocationHandler.invokeMethod(METHOD, ARGS));
+ assertEquals(RESULT, winRMInvocationHandler.invokeMethod(RECEIVE_METHOD, RECEIVE_ARGS));
- verify(METHOD, times(3)).invoke(WIN_RM_WS, ARGS);
+ verifyReceiveInvoked(3);
}
@Test
@@ -751,11 +783,10 @@ void testCreateCredentials() {
@Test
void testCreateCallInfos() {
assertEquals(EMPTY, createCallInfos(null, null));
- assertEquals(EMPTY, createCallInfos(mock(Method.class), null));
- assertEquals("Receive", createCallInfos(METHOD, null));
+ assertEquals("receive", createCallInfos(RECEIVE_METHOD, null));
assertEquals(EMPTY, createCallInfos(null, ARGS));
final Object[] args = { "arg1", 2, true };
- assertEquals("Receive arg1 2 true", createCallInfos(METHOD, args));
+ assertEquals("receive arg1 2 true", createCallInfos(RECEIVE_METHOD, args));
}
}