@Test public void deleteList() { List<GroceryList> defaultLists = defaultRepository.getLists().getGroceryLists(); defaultLists.forEach(sl -> emptyRepository.createList(sl)); assertTrue(emptyRepository.deleteList(defaultLists.get(1).getId())); assertFalse(emptyRepository.deleteList(UUID.randomUUID())); assertEquals(2, emptyRepository.getLists().size()); }
public boolean deleteList(UUID uuid) { boolean success = groceryLists.removeIf(list -> uuid.equals(list.getId())); save(); return success; }
Repository { public boolean deleteList(UUID uuid) { boolean success = groceryLists.removeIf(list -> uuid.equals(list.getId())); save(); return success; } }
Repository { public boolean deleteList(UUID uuid) { boolean success = groceryLists.removeIf(list -> uuid.equals(list.getId())); save(); return success; } @Inject  Repository(@Named("datastore") File dataFile, ModelSerializer serializer); }
Repository { public boolean deleteList(UUID uuid) { boolean success = groceryLists.removeIf(list -> uuid.equals(list.getId())); save(); return success; } @Inject  Repository(@Named("datastore") File dataFile, ModelSerializer serializer); UUID createList(GroceryList groceryList); Optional<GroceryList> getList(UUID id); GroceryLists getLists(); boolean updateList(UUID uuid, GroceryList updatedList); boolean deleteList(UUID uuid); }
Repository { public boolean deleteList(UUID uuid) { boolean success = groceryLists.removeIf(list -> uuid.equals(list.getId())); save(); return success; } @Inject  Repository(@Named("datastore") File dataFile, ModelSerializer serializer); UUID createList(GroceryList groceryList); Optional<GroceryList> getList(UUID id); GroceryLists getLists(); boolean updateList(UUID uuid, GroceryList updatedList); boolean deleteList(UUID uuid);  }