@Test public void validJsonResponseReturnsPopulatedCoverArt() throws IOException { CoverArt coverArt = factory.valueOf(json); assertThat(coverArt.getMusicBrainzReleaseUrl(), is(MUSICBRAINZ_URL)); assertThat(coverArt.getImages(), hasSize(1)); CoverArtImage coverArtImage = coverArt.getImages().iterator().next(); assertThat(coverArtImage.getId(), is(829521842L)); assertThat(coverArtImage.getEdit(), is(17462565L)); assertThat(coverArtImage.getTypes(), hasSize(1)); assertThat(coverArtImage.getTypes(), is(hasItem(CoverArtType.FRONT))); assertThat(coverArtImage.getImage(), is(inputStream)); assertThat(coverArtImage.isFront(), is(true)); assertThat(coverArtImage.isBack(), is(false)); assertThat(coverArtImage.getComment(), is("")); assertThat(coverArtImage.isApproved(), is(true)); assertThat(coverArtImage.getLargeThumbnail(), is(inputStream)); assertThat(coverArtImage.getSmallThumbnail(), is(inputStream)); }
@Test public void emptyJsonStringReturnsNull() throws IOException { CoverArt coverArt = factory.valueOf(""); assertThat(coverArt, is(nullValue())); }