示例#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"));
  }