### Question:
Twitter { public void updateProfileImage(final byte[] image) { checkArgument(ArrayUtils.isNotEmpty(image), "`image` should not be empty."); log.info("Updating profile image"); final var stream = new ByteArrayInputStream(image); try { underlying.updateProfileImage(stream); } catch (twitter4j.TwitterException e) { throw new TwitterException(e); } log.info("Updated profile image"); } Twitter(
        final String consumerKey,
        final String consumerSecret,
        final String accessToken,
        final String accessTokenSecret,
        final Duration connectionTimeout,
        final Duration readTimeout
    ); @VisibleForTesting  Twitter(
        final twitter4j.Twitter twitter
    ); void updateProfileImage(final byte[] image);  }### Answer:
@Test @SneakyThrows public void updateProfileImageTest() { final Twitter twitter = new Twitter(underlying); when(underlying.updateProfileImage((InputStream) any())).thenReturn(user); twitter.updateProfileImage(new byte[]{0x01, 0x02, 0x03}); verify(underlying).updateProfileImage((InputStream) any()); }
@Test public void updateProfileImageEmptyImageTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`image` should not be empty."); final Twitter twitter = new Twitter(underlying); twitter.updateProfileImage(new byte[]{}); }
@Test public void updateProfileImageNullImageTest() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("`image` should not be empty."); final Twitter twitter = new Twitter(underlying); twitter.updateProfileImage(null); }