@Test public void createList() { assertNull(groceryList.getId()); emptyRepository.createList(groceryList); assertNotNull(groceryList.getId()); assertTrue(emptyRepository.getList(groceryList.getId()).isPresent()); }
public UUID createList(GroceryList groceryList) { UUID newId = UUID.randomUUID(); groceryList.setId(newId); groceryLists.add(groceryList); save(); return newId; }
Repository { public UUID createList(GroceryList groceryList) { UUID newId = UUID.randomUUID(); groceryList.setId(newId); groceryLists.add(groceryList); save(); return newId; } }
Repository { public UUID createList(GroceryList groceryList) { UUID newId = UUID.randomUUID(); groceryList.setId(newId); groceryLists.add(groceryList); save(); return newId; } @Inject  Repository(@Named("datastore") File dataFile, ModelSerializer serializer); }
Repository { public UUID createList(GroceryList groceryList) { UUID newId = UUID.randomUUID(); groceryList.setId(newId); groceryLists.add(groceryList); save(); return newId; } @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 UUID createList(GroceryList groceryList) { UUID newId = UUID.randomUUID(); groceryList.setId(newId); groceryLists.add(groceryList); save(); return newId; } @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);  }