Beispiel #1
0
  public void testIncludesBothOriginalAndMappedGenres() throws Exception {

    Set<String> genres = Sets.newHashSet("http://ref.atlasapi.org/genres/youtube/comedy");
    Set<String> mappedGenres = genreMap.map(genres);
    assertThat(mappedGenres.size(), is(2));
    assertThat(mappedGenres, hasItem("http://ref.atlasapi.org/genres/youtube/comedy"));
  }
Beispiel #2
0
  public void testIsNotCaseSensitive() throws Exception {

    Set<String> genres = Sets.newHashSet("http://ref.atlasapi.org/genres/youtube/Comedy");
    Set<String> mappedGenres = genreMap.map(genres);
    assertThat(mappedGenres.size(), is(2));
    assertThat(mappedGenres, hasItem("http://ref.atlasapi.org/genres/youtube/Comedy"));
    assertThat(mappedGenres, hasItem("http://ref.atlasapi.org/genres/atlas/comedy"));
  }
 private void setGenres(ProgData progData, Content content) {
   Set<String> extractedGenres =
       genreMap.map(
           ImmutableSet.copyOf(Iterables.transform(progData.getCategory(), TO_GENRE_URIS)));
   extractedGenres.remove("http://pressassociation.com/genres/BE00");
   if (!extractedGenres.isEmpty()) {
     content.setGenres(extractedGenres);
   }
 }
Beispiel #4
0
  public void testReturnsGenresAsInputForUnknownGenres() throws Exception {

    Set<String> genres = Sets.newHashSet("http://example.com/genres/unknown");
    assertThat(genreMap.map(genres), is(genres));
  }
Beispiel #5
0
  public void testMapsGenresFromYoutubeGenresToAtlasGenres() throws Exception {

    Set<String> genres = Sets.newHashSet("http://ref.atlasapi.org/genres/youtube/comedy");
    assertThat(genreMap.map(genres), hasItem("http://ref.atlasapi.org/genres/atlas/comedy"));
  }