@Test public void testClearFromDisk() { ParseObjectStore<ParseUser> store = (ParseObjectStore<ParseUser>) mock(ParseObjectStore.class); when(store.deleteAsync()).thenReturn(Task.<Void>forResult(null)); CachedCurrentUserController controller = new CachedCurrentUserController(store); controller.currentUser = new ParseUser(); controller.clearFromDisk(); assertNull(controller.currentUser); assertFalse(controller.currentUserMatchesDisk); verify(store, times(1)).deleteAsync(); }
@Override public void clearFromDisk() { synchronized (mutex) { currentUser = null; currentUserMatchesDisk = false; } try { ParseTaskUtils.wait(store.deleteAsync()); } catch (ParseException e) { } }
CachedCurrentUserController implements ParseCurrentUserController { @Override public void clearFromDisk() { synchronized (mutex) { currentUser = null; currentUserMatchesDisk = false; } try { ParseTaskUtils.wait(store.deleteAsync()); } catch (ParseException e) { } } }
CachedCurrentUserController implements ParseCurrentUserController { @Override public void clearFromDisk() { synchronized (mutex) { currentUser = null; currentUserMatchesDisk = false; } try { ParseTaskUtils.wait(store.deleteAsync()); } catch (ParseException e) { } } CachedCurrentUserController(ParseObjectStore<ParseUser> store); }
CachedCurrentUserController implements ParseCurrentUserController { @Override public void clearFromDisk() { synchronized (mutex) { currentUser = null; currentUserMatchesDisk = false; } try { ParseTaskUtils.wait(store.deleteAsync()); } catch (ParseException e) { } } CachedCurrentUserController(ParseObjectStore<ParseUser> store); @Override Task<Void> setAsync(final ParseUser user); @Override Task<Void> setIfNeededAsync(ParseUser user); @Override Task<ParseUser> getAsync(); @Override Task<Boolean> existsAsync(); @Override boolean isCurrent(ParseUser user); @Override void clearFromMemory(); @Override void clearFromDisk(); @Override Task<String> getCurrentSessionTokenAsync(); @Override Task<Void> logOutAsync(); @Override Task<ParseUser> getAsync(final boolean shouldAutoCreateUser); }
CachedCurrentUserController implements ParseCurrentUserController { @Override public void clearFromDisk() { synchronized (mutex) { currentUser = null; currentUserMatchesDisk = false; } try { ParseTaskUtils.wait(store.deleteAsync()); } catch (ParseException e) { } } CachedCurrentUserController(ParseObjectStore<ParseUser> store); @Override Task<Void> setAsync(final ParseUser user); @Override Task<Void> setIfNeededAsync(ParseUser user); @Override Task<ParseUser> getAsync(); @Override Task<Boolean> existsAsync(); @Override boolean isCurrent(ParseUser user); @Override void clearFromMemory(); @Override void clearFromDisk(); @Override Task<String> getCurrentSessionTokenAsync(); @Override Task<Void> logOutAsync(); @Override Task<ParseUser> getAsync(final boolean shouldAutoCreateUser);  }