예제 #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"));
  }
예제 #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"));
  }
예제 #3
0
 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);
   }
 }
예제 #4
0
  public void testReturnsGenresAsInputForUnknownGenres() throws Exception {

    Set<String> genres = Sets.newHashSet("http://example.com/genres/unknown");
    assertThat(genreMap.map(genres), is(genres));
  }
예제 #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"));
  }