@Test public void addUserTest() { final boolean isSuccessful = datastoreUpdateActions.user(realmUserMock, user); verify(realmMock, times(1)).beginTransaction(); verify(realmUserMock, times(1)).setName(user.getName()); verify(realmUserMock, times(1)).setUsername(user.getUsername()); verify(realmUserMock, times(1)).setEmail(user.getEmail()); verifyNoMoreInteractions(realmUserMock); verify(realmMock, times(1)).commitTransaction(); verifyNoMoreInteractions(realmMock); assertThat(isSuccessful).isTrue(); }
@Override public boolean user(final User existingRealUser, final User user) { realm.beginTransaction(); existingRealUser.setName(user.getName()); existingRealUser.setUsername(user.getUsername()); existingRealUser.setEmail(user.getEmail()); realm.commitTransaction(); return true; }
DatastoreUpdateActions implements UpdateActions { @Override public boolean user(final User existingRealUser, final User user) { realm.beginTransaction(); existingRealUser.setName(user.getName()); existingRealUser.setUsername(user.getUsername()); existingRealUser.setEmail(user.getEmail()); realm.commitTransaction(); return true; } }
DatastoreUpdateActions implements UpdateActions { @Override public boolean user(final User existingRealUser, final User user) { realm.beginTransaction(); existingRealUser.setName(user.getName()); existingRealUser.setUsername(user.getUsername()); existingRealUser.setEmail(user.getEmail()); realm.commitTransaction(); return true; } DatastoreUpdateActions(final Realm realm); }
DatastoreUpdateActions implements UpdateActions { @Override public boolean user(final User existingRealUser, final User user) { realm.beginTransaction(); existingRealUser.setName(user.getName()); existingRealUser.setUsername(user.getUsername()); existingRealUser.setEmail(user.getEmail()); realm.commitTransaction(); return true; } DatastoreUpdateActions(final Realm realm); @Override boolean user(final User existingRealUser, final User user); }
DatastoreUpdateActions implements UpdateActions { @Override public boolean user(final User existingRealUser, final User user) { realm.beginTransaction(); existingRealUser.setName(user.getName()); existingRealUser.setUsername(user.getUsername()); existingRealUser.setEmail(user.getEmail()); realm.commitTransaction(); return true; } DatastoreUpdateActions(final Realm realm); @Override boolean user(final User existingRealUser, final User user);  }