コード例 #1
0
  public void testGetExpectedAppData() throws Exception {
    DataCollection responseItem =
        db.getPersonData(
                ImmutableSet.of(CANON_USER),
                SELF_GROUP,
                APP_ID,
                Collections.<String>emptySet(),
                new FakeGadgetToken())
            .get();
    assertFalse(responseItem.getEntry().isEmpty());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).isEmpty());

    assertSame(2, responseItem.getEntry().get(CANONICAL_USER_ID).size());
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("count"));
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("size"));
  }
コード例 #2
0
  public void testDeleteExpectedAppData() throws Exception {
    // Delete the data
    db.deletePersonData(
        CANON_USER, SELF_GROUP, APP_ID, ImmutableSet.of("count"), new FakeGadgetToken());

    // Fetch the remaining and test
    DataCollection responseItem =
        db.getPersonData(
                ImmutableSet.of(CANON_USER),
                SELF_GROUP,
                APP_ID,
                Collections.<String>emptySet(),
                new FakeGadgetToken())
            .get();
    assertFalse(responseItem.getEntry().isEmpty());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).isEmpty());

    assertSame(1, responseItem.getEntry().get(CANONICAL_USER_ID).size());
    assertFalse(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("count"));
    assertTrue(responseItem.getEntry().get(CANONICAL_USER_ID).containsKey("size"));
  }