public void testGetExpectedActivity() throws Exception { Activity activity = db.getActivity( CANON_USER, SELF_GROUP, APP_ID, ImmutableSet.of("appId", "body", "mediaItems"), APP_ID, new FakeGadgetToken()) .get(); assertNotNull(activity); // Check that some fields are fetched and others are not assertNotNull(activity.getBody()); assertNull(activity.getBodyId()); }
public void testDeleteExpectedActivity() throws Exception { db.deleteActivities( CANON_USER, SELF_GROUP, APP_ID, ImmutableSet.of(APP_ID), new FakeGadgetToken()); // Try to fetch the activity try { db.getActivity( CANON_USER, SELF_GROUP, APP_ID, ImmutableSet.of("appId", "body", "mediaItems"), APP_ID, new FakeGadgetToken()) .get(); fail(); } catch (ProtocolException sse) { assertEquals(HttpServletResponse.SC_BAD_REQUEST, sse.getCode()); } }