### Question:
Gravatar { public void chooseImage( final List<String> images, final List<String> addresses ) { checkArgument(CollectionUtils.isNotEmpty(images), "`images` should not be empty"); checkArgument(CollectionUtils.isNotEmpty(addresses), "`addresses` should not be empty"); final int chosen = random.nextInt(images.size()); final String chosenImage = images.get(chosen); final Map<String, Boolean> statuses; try { statuses = gravatarClient.useUserImage(password, chosenImage, addresses); } catch (GravatarClientException e) { throw new GravatarException(e); } final long successfulNumber = statuses.values() .stream() .filter(status -> status) .count(); if (addresses.size() != successfulNumber) { throw new GravatarException(String.format( "Failed to use a chosen image :: chosen-image=%s, response=%s", chosenImage, statuses.toString())); } } Gravatar(
        final GravatarClient gravatarClient,
        final String password
    );  Gravatar(
        final GravatarClient gravatarClient,
        final String password,
        final Random random
    ); List<UserImage> getUserImages(); void chooseImage(
        final List<String> images,
        final List<String> addresses
    );  }### Answer:
@Test public void chooseImageTest() { }
@Test public void chooseImageTest_emptyImages() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`images` should not be empty"); gravatar.chooseImage( Collections.emptyList(), List.of("example@example.com")); }
@Test public void chooseImageTest_emptyAddresses() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`addresses` should not be empty"); gravatar.chooseImage( List.of("example@example.com"), Collections.emptyList()); }