use of com.google.gwt.user.server.rpc.RPCRequest in project pentaho-platform by pentaho.
the class AbstractGwtRpcTest method testGetRequestFirstTime.
// endregion
// region Request
@Test
public void testGetRequestFirstTime() {
String requestPayload = "REQUEST_PAYLOAD";
// new Object would have a null class loader!
Object target = this;
RPCRequest rpcRequest = new RPCRequest(null, null, null, 0);
HttpServletRequest httpRequestMock = mock(HttpServletRequest.class);
TestGwtRpc gwtRpcSpy = spy(new TestGwtRpc(httpRequestMock));
doReturn(requestPayload).when(gwtRpcSpy).getRequestPayload();
doReturn(target).when(gwtRpcSpy).resolveTarget();
try (MockedStatic<RPC> rpc = Mockito.mockStatic(RPC.class)) {
rpc.when(() -> RPC.decodeRequest(eq(requestPayload), eq(null), any())).thenReturn(rpcRequest);
RPCRequest result = gwtRpcSpy.getRequest();
assertEquals(rpcRequest, result);
}
}
Aggregations