@SuppressWarnings({"unchecked", "serial"})
@Test
public void testCreateIdentity_Success() throws Exception {
CreateIdentityRequestVO createIdentityRequestVO = ImmutableCreateIdentityRequestVO.builder()
.setAuth("auth")
.setIdentityMap(new HashMap<String, Object>() {{
put("key", "value");
}})
.build();
CreateIdentityResponseVO returnedCreateIdentityResponseVO = ImmutableCreateIdentityResponseVO.builder().build();
JsonRpcUtils mockJsonRpcUtils = PowerMockito.mock(JsonRpcUtils.class);
PowerMockito.whenNew(JsonRpcUtils.class).withNoArguments().thenReturn(mockJsonRpcUtils);
Mockito.when(mockJsonRpcUtils.sendJsonRpcRequest(Mockito.anyString(), Mockito.any(), Mockito.anyString(), Mockito.isA(Map.class))).thenReturn(returnedCreateIdentityResponseVO);
identitiesAsyncService = new IdentitiesAsyncServiceImpl(enjinConfig);
CompletableFuture<CreateIdentityResponseVO> createIdentityResponseCompletableFutureVO = identitiesAsyncService.createIdentityAsync(createIdentityRequestVO);
assertThat(createIdentityResponseCompletableFutureVO).isNotNull();
CreateIdentityResponseVO createIdentityResponseVO = createIdentityResponseCompletableFutureVO.get();
assertThat(createIdentityResponseVO).isNotNull();
PowerMockito.verifyNew(JsonRpcUtils.class, Mockito.times(1)).withNoArguments();
Mockito.verify(mockJsonRpcUtils, Mockito.times(1)).sendJsonRpcRequest(Mockito.anyString(), Mockito.any(), Mockito.anyString(), Mockito.isA(Map.class));
}
IdentitiesAsyncServiceTest.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:Enjin-Coin-Java-SDK
作者:
评论列表
文章目录