@Test
public void testScanInNeighborhoodNotLoggedIn() {

    final SettableFuture<Boolean> errored = SettableFuture.create();
    Syncbase.ScanNeighborhoodForUsersCallback cb =
            new Syncbase.ScanNeighborhoodForUsersCallback() {
                @Override
                public void onFound(User user) {}
                @Override
                public void onLost(User user) {}
                @Override
                public void onError(Throwable e) {
                    // This is expected to be called.
                    assertNotNull("should error", e);
                    errored.set(true);
                }
            };
    // Force an error because the user was not logged in.
    Syncbase.addScanForUsersInNeighborhood(cb);
    // Give the callback time to be called.
    try {
        assertTrue(errored.get(1, TimeUnit.SECONDS));
    } catch (InterruptedException | TimeoutException | ExecutionException e) {
        fail("should have been able to get successfully");
    }
}