### Question:
GravatarClient { public Map<String, Boolean> useUserImage( final String password, final String userImage, final List<String> addresses ) { checkArgument(StringUtils.isNotEmpty(password), "`password` should not be empty"); checkArgument(StringUtils.isNotEmpty(userImage), "`userImage` should not be empty"); checkArgument(CollectionUtils.isNotEmpty(addresses), "`addresses` should not be empty"); final Map<String, Object> params = Map.of( "password", password, "userimage", userImage, "addresses", addresses ); try { final Object response = rpcClient.execute("grav.useUserimage", new Object[]{params}); return statusFactory.from(response); } catch (XmlRpcException e) { throw new GravatarClientException("Failed to call `grav.useUserimage` API", e); } } GravatarClient(final String email); protected  GravatarClient(
        final String email,
        final XmlRpcClient rpcClient,
        final UserImageFactory userImageFactory,
        final StatusFactory statusFactory
    ); List<UserImage> getUserImages(final String password); Map<String, Boolean> useUserImage(
        final String password,
        final String userImage,
        final List<String> addresses
    );  }### Answer:
@Test @SneakyThrows public void useUserImageTest() { final Map<String, Object> params = ImmutableMap.of( "password", PASSWORD, "userimage", "userImage", "addresses", Collections.singletonList(EMAIL) ); final Object rpcResult = new Object(); final Map<String, Boolean> expected = Maps.newHashMap(); when(xmlRpcClient.execute("grav.useUserimage", new Object[]{params})) .thenReturn(rpcResult); when(statusFactory.from(rpcResultCaptor.capture())).thenReturn(expected); final Map<String, Boolean> actual = gravatarClient.useUserImage(PASSWORD, "userImage", Collections.singletonList(EMAIL)); assertSame(expected, actual); assertSame(rpcResult, rpcResultCaptor.getValue()); verify(xmlRpcClient).execute(anyString(), any()); verify(statusFactory).from(any()); }
@Test public void useUserImageEmptyPasswordTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`password` should not be empty"); gravatarClient.useUserImage(StringUtils.EMPTY, "userImage", Collections.singletonList(EMAIL)); }
@Test public void useUserImageNullPasswordTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`password` should not be empty"); gravatarClient.useUserImage(null, "userImage", Collections.singletonList(EMAIL)); }
@Test public void useUserImageEmptyUserImageTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`userImage` should not be empty"); gravatarClient.useUserImage(PASSWORD, StringUtils.EMPTY, Collections.singletonList(EMAIL)); }
@Test public void useUserImageEmptyAddressesTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`addresses` should not be empty"); gravatarClient.useUserImage(PASSWORD, "userImage", Collections.emptyList()); }