@Test @Ignore public void shouldShowNoArtistTabs_WhenThereAreNoArtists() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", new ArrayList<Artist>()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat(tags.matching(".artist-tabs li"), not(exists())); }
@Test @Ignore public void shouldShowTwoArtistTabs_WhenThereAreTwoArtists() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getTwoArtistsWithNoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat(tags.matching(".artist-tabs li"), hasSize(2)); }
@Test @Ignore public void shouldNotShowCdAvailableImage_WhenCdIsNotAvailable() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getOneArtistWithOneAlbum()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat(tags.matching(".cd-available"), not(exists())); }
@Test @Ignore public void shouldShowOneAlbum_WhenThereIsOneAlbum() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getOneArtistWithOneAlbum()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat(tags.matching(".album"), occursOnce()); }
@Test @Ignore public void shouldSetTheAlbumName_WhenThereIsOneAlbum() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getOneArtistWithOneAlbum()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat(tags.matching(".album h3"), isSingleElementThat(hasOnlyText("expected album name"))); }
@Test @Ignore public void shouldSetTheSecondTabCssClassToTabTitle_WhenThereAreTwoArtists() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getTwoArtistsWithNoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".artist-tabs li:first-of-type"), isSingleElementThat(hasClass("tab-title"))); }
@Test @Ignore public void shouldShowVinylAvailableImage_WhenVinylIsAvailable() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); List<Artist> artists = getOneArtistWithOneAlbum(); artists.get(0).getAlbums().get(0).setVinylAvailable(true); model.put("artists", artists); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat(tags.matching(".vinyl-available"), occursOnce()); }
@Test @Ignore public void shouldNotSetTheSecondAlbumCssClassToActive_WhenThereAreTwoAlbums() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getOneArtistWithTwoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".album:nth-of-type(2) > div"), isSingleElementThat(not(hasClass("active")))); }
@Test @Ignore public void shouldSetTheArtistImageSrc_WhenThereIsOneArtist() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getOneArtistWithNoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".artist-image"), isSingleElementThat(hasAttribute("src", "expected artist image"))); }
@Test @Ignore public void shouldSetTheFirstArtistIdToArtist1_WhenThereAreTwoArtists() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getTwoArtistsWithNoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".artist:first-of-type"), isSingleElementThat(hasAttribute("id", "artist1"))); }
@Test @Ignore public void shouldSetTheSecondArtistDivCssClassesToArtistContent_WhenThereAreTwoArtists() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getTwoArtistsWithNoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".artist:nth-of-type(2)"), isSingleElementThat(hasClasses("artist content"))); }
@Test @Ignore public void shouldSetTheSecondTabHrefToArtist2_WhenThereAreTwoArtists() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getTwoArtistsWithNoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".artist-tabs li:nth-of-type(2) a"), isSingleElementThat(hasAttribute("href", "#artist2"))); }
@Test @Ignore public void shouldSetTheSecondArtistSecondAlbumIdToArtist2Album2_WhenThereAreTwoArtistsEachWithTwoAlbums() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getTwoArtistsEachWithTwoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".artist:nth-of-type(2) .album:nth-of-type(2) > div"), isSingleElementThat(hasAttribute("id", "artist2-album2"))); }
@Test @Ignore public void shouldSetTheFirstArtistSecondAccordionEntryHrefToArtist1Album2_WhenThereAreTwoArtistsEachWithTwoAlbums() throws NodeSelectorException { Map<String, Object> model = new HashMap<String, Object>(); model.put("artists", getTwoArtistsEachWithTwoAlbums()); HtmlElements tags = selectorEngine.process(HTML_PATH, model); assertThat( tags.matching(".artist:first-of-type .album:nth-of-type(2) a"), isSingleElementThat(hasAttribute("href", "#artist1-album2"))); }