### Question:
TwitterService { public void updateImage(final byte[] image) { checkArgument(ArrayUtils.isNotEmpty(image), "`image` should not be empty."); twitter.updateProfileImage(image); }  void updateImage(final byte[] image);  }### Answer:
@Test public void updateImageEmptyImageTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`image` should not be empty."); doNothing().when(twitter).updateProfileImage(any()); twitterService.updateImage(new byte[]{}); verify(twitter, never()).updateProfileImage(any()); }
@Test public void updateImageTest() { final byte[] imageBytes = new byte[]{0x00, 0x01, 0x02}; doNothing().when(twitter).updateProfileImage(imageBytes); twitterService.updateImage(imageBytes); verify(twitter, times(1)).updateProfileImage(imageBytes); }
@Test public void updateImageNullImageTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`image` should not be empty."); doNothing().when(twitter).updateProfileImage(any()); twitterService.updateImage(null); verify(twitter, never()).updateProfileImage(any()); }