Ejemplo n.º 1
0
  @Test
  public void favelists_api_should_get_master_list() {
    String listName = "hababi";
    String songId = "radSongId";
    Hashtag hashtag = new Hashtag(listName, "Joan d'Arc");

    List<FaveItem> faveItems = new ArrayList<>();
    faveItems.add(new FaveItem("This", "be", songId));
    hashtag.setList(faveItems);
    ofy().save().entity(hashtag).now();

    List<FaveItem> masterList = FaveListsApi.getMasterFaveList(listName, ListMode.USERS).getItems();
    assertThat(masterList.size()).isEqualTo(1);
    assertThat(masterList).extracting("songID").contains(songId);
  }
Ejemplo n.º 2
0
  @Test
  public void favelists_api_should_not_get_any_list_names_with_less_than_ten_items() {
    String listName = "list";
    Hashtag hashtag = new Hashtag(listName, "Raggaz");

    List<FaveItem> faveItems = new ArrayList<>();
    for (int i = 0; i < FaveListsApi.QUALITY_LIST_SIZE - 1; i++) {
      faveItems.add(new FaveItem("just", "under", "limit"));
    }
    hashtag.setList(faveItems);
    ofy().save().entity(hashtag).now();

    List<StringResult> listNames = FaveListsApi.getListNames().getItems();
    assertEquals(0, listNames.size());
    assertThat(listNames.size()).isEqualTo(0);
  }
Ejemplo n.º 3
0
  @Test
  public void favelists_api_should_get_all_list_names_with_at_least_ten_items() {
    String list1 = "list1";
    String list2 = "list2";
    Hashtag hashtag1 = new Hashtag(list1, "whocares");
    Hashtag hashtag2 = new Hashtag(list2, "notme");

    List<FaveItem> faveItems = new ArrayList<>();
    for (int i = 0; i < FaveListsApi.QUALITY_LIST_SIZE; i++) {
      faveItems.add(new FaveItem("really", "doesn't", "matter"));
    }
    hashtag1.setList(faveItems);
    hashtag2.setList(faveItems);
    ofy().save().entities(hashtag1, hashtag2).now();

    List<StringResult> listNames = FaveListsApi.getListNames().getItems();
    assertThat(listNames.size()).isEqualTo(2);
    assertThat(listNames).extracting("value").contains(list1, list2);
  }