@Test public void addUserTest() { when(realmMock.where(User.class)).thenReturn(realmQueryMock); when(realmQueryMock.equalTo(User.ID, user.getId())).thenReturn(realmQueryMock); when(realmQueryMock.findFirst()).thenReturn(user); final User persistedUser = datastoreGetActions.user(user.getId()); verify(realmMock, times(1)).where(User.class); verifyNoMoreInteractions(realmMock); verify(realmQueryMock, times(1)).equalTo(User.ID, user.getId()); verify(realmQueryMock, times(1)).findFirst(); verifyNoMoreInteractions(realmQueryMock); assertThat(persistedUser).isEqualTo(user); }
@Nullable @Override public User user(final Integer userId) { return realm.where(User.class) .equalTo(User.ID, userId) .findFirst(); }
DatastoreGetActions implements GetActions { @Nullable @Override public User user(final Integer userId) { return realm.where(User.class) .equalTo(User.ID, userId) .findFirst(); } }
DatastoreGetActions implements GetActions { @Nullable @Override public User user(final Integer userId) { return realm.where(User.class) .equalTo(User.ID, userId) .findFirst(); } DatastoreGetActions(final Realm realm); }
DatastoreGetActions implements GetActions { @Nullable @Override public User user(final Integer userId) { return realm.where(User.class) .equalTo(User.ID, userId) .findFirst(); } DatastoreGetActions(final Realm realm); @Nullable @Override User user(final Integer userId); }
DatastoreGetActions implements GetActions { @Nullable @Override public User user(final Integer userId) { return realm.where(User.class) .equalTo(User.ID, userId) .findFirst(); } DatastoreGetActions(final Realm realm); @Nullable @Override User user(final Integer userId);  }