@Test public void testDeleteFavorite() throws Exception { List<Map<String, byte[]>> queryResult = prepareFavorites(); Mockito.doReturn(queryResult).when(transaction).select(Mockito.anyString(), Mockito.eq(username.getUsername())); Mockito.doNothing().when(transaction).insert(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); List<Experiment.ID> results = databaseFavoritesRepository.deleteFavorite(username, Experiment.ID.newInstance()); Assert.assertArrayEquals("Not all expected favorites are returned.", expectedResult(queryResult).toArray(), results.toArray()); }
@Override public List<Experiment.ID> deleteFavorite(UserInfo.Username username, Experiment.ID experimentID) throws RepositoryException { updateFavorite(username, experimentID, false); return getFavorites(username); }
DatabaseFavoritesRepository implements FavoritesRepository { @Override public List<Experiment.ID> deleteFavorite(UserInfo.Username username, Experiment.ID experimentID) throws RepositoryException { updateFavorite(username, experimentID, false); return getFavorites(username); } }
DatabaseFavoritesRepository implements FavoritesRepository { @Override public List<Experiment.ID> deleteFavorite(UserInfo.Username username, Experiment.ID experimentID) throws RepositoryException { updateFavorite(username, experimentID, false); return getFavorites(username); } @Inject  DatabaseFavoritesRepository(final TransactionFactory transactionFactory, final Flyway flyway,
                                       final @Named("mysql.mutagen.root.resource.path") String mutagenRootResourcePath); }
DatabaseFavoritesRepository implements FavoritesRepository { @Override public List<Experiment.ID> deleteFavorite(UserInfo.Username username, Experiment.ID experimentID) throws RepositoryException { updateFavorite(username, experimentID, false); return getFavorites(username); } @Inject  DatabaseFavoritesRepository(final TransactionFactory transactionFactory, final Flyway flyway,
                                       final @Named("mysql.mutagen.root.resource.path") String mutagenRootResourcePath); @Override List<Experiment.ID> getFavorites(UserInfo.Username username); @Override List<Experiment.ID> addFavorite(UserInfo.Username username, Experiment.ID experimentID); @Override List<Experiment.ID> deleteFavorite(UserInfo.Username username, Experiment.ID experimentID); }
DatabaseFavoritesRepository implements FavoritesRepository { @Override public List<Experiment.ID> deleteFavorite(UserInfo.Username username, Experiment.ID experimentID) throws RepositoryException { updateFavorite(username, experimentID, false); return getFavorites(username); } @Inject  DatabaseFavoritesRepository(final TransactionFactory transactionFactory, final Flyway flyway,
                                       final @Named("mysql.mutagen.root.resource.path") String mutagenRootResourcePath); @Override List<Experiment.ID> getFavorites(UserInfo.Username username); @Override List<Experiment.ID> addFavorite(UserInfo.Username username, Experiment.ID experimentID); @Override List<Experiment.ID> deleteFavorite(UserInfo.Username username, Experiment.ID experimentID);  }