@Test public void testHasReadAccessWithReadAccess() { ParseUser user = mock(ParseUser.class); when(user.getObjectId()).thenReturn("test"); ParseACL acl = mock(ParseACL.class); when(acl.getReadAccess(user)).thenReturn(true); ParseObject object = mock(ParseObject.class); when(object.getACL()).thenReturn(acl); assertTrue(OfflineQueryLogic.hasReadAccess(user, object)); }
@Test public void testMatcherWithNoReadAccess() throws ParseException { OfflineQueryLogic logic = new OfflineQueryLogic(null); ParseQuery.State<ParseObject> query = new ParseQuery.State.Builder<>("TestObject").build(); ParseACL acl = new ParseACL(); acl.setPublicReadAccess(false); ParseObject object = new ParseObject("TestObject"); object.setACL(acl); ParseUser user = mock(ParseUser.class); when(user.getObjectId()).thenReturn("test"); assertFalse(matches(logic, query, object, user)); }