Drop RecipeMetadataDatabase.findAllById(List<Long>)
No point in supporting this at the moment.
- Id
- ae0661c7225d817dd2e8f69735ffdc3b53a692c6
- Author
- Caio
- Commit time
- 2019-05-21T09:38:26+02:00
Modified src/main/java/co/caio/cerberus/db/RecipeMetadataDatabase.java
Optional<RecipeMetadata> findById(long recipeId);
- List<RecipeMetadata> findAllById(List<Long> recipeIds);
-
void saveAll(List<RecipeMetadata> recipes);
default void close() {}
Modified src/main/java/co/caio/cerberus/db/SimpleRecipeMetadataDatabase.java
}
@Override
- public List<RecipeMetadata> findAllById(List<Long> recipeIds) {
- return null;
- }
-
- @Override
public void saveAll(List<RecipeMetadata> recipes) {
throw new RecipeMetadataDbException("Read-only! Use the Writer inner class to create a db");
}
Modified src/test/java/co/caio/cerberus/db/HashMapRecipeMetadataDatabase.java
package co.caio.cerberus.db;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Override
public Optional<RecipeMetadata> findById(long recipeId) {
return Optional.ofNullable(map.get(recipeId));
- }
-
- @Override
- public List<RecipeMetadata> findAllById(List<Long> recipeIds) {
- var result = new ArrayList<RecipeMetadata>();
- recipeIds.forEach(id -> findById(id).ifPresent(result::add));
- return result;
}
@Override