@Test public void delete_shouldNotDeleteForNonExistingIsbn() { assertFalse(bookDao.delete(book)); }
public boolean delete(@Nonnull final Book bookToDelete) { checkNotNull(bookToDelete, "Argument[bookToDelete] must not be null"); Book book = books.get(bookToDelete.getIsbn()); if (book != null) { synchronized (book) { return books.remove(book.getIsbn(), book); } } return false; }
BookDao { public boolean delete(@Nonnull final Book bookToDelete) { checkNotNull(bookToDelete, "Argument[bookToDelete] must not be null"); Book book = books.get(bookToDelete.getIsbn()); if (book != null) { synchronized (book) { return books.remove(book.getIsbn(), book); } } return false; } }
BookDao { public boolean delete(@Nonnull final Book bookToDelete) { checkNotNull(bookToDelete, "Argument[bookToDelete] must not be null"); Book book = books.get(bookToDelete.getIsbn()); if (book != null) { synchronized (book) { return books.remove(book.getIsbn(), book); } } return false; }  }
BookDao { public boolean delete(@Nonnull final Book bookToDelete) { checkNotNull(bookToDelete, "Argument[bookToDelete] must not be null"); Book book = books.get(bookToDelete.getIsbn()); if (book != null) { synchronized (book) { return books.remove(book.getIsbn(), book); } } return false; }  @Nonnull Optional<Book> create(@Nonnull final Book bookToCreate); @Nonnull List<Book> readAll(); @Nonnull Optional<Book> readByIsbn(@Nonnull final String isbn); @Nonnull Optional<Book> update(@Nonnull final Book bookToUpdate); boolean delete(@Nonnull final Book bookToDelete); }
BookDao { public boolean delete(@Nonnull final Book bookToDelete) { checkNotNull(bookToDelete, "Argument[bookToDelete] must not be null"); Book book = books.get(bookToDelete.getIsbn()); if (book != null) { synchronized (book) { return books.remove(book.getIsbn(), book); } } return false; }  @Nonnull Optional<Book> create(@Nonnull final Book bookToCreate); @Nonnull List<Book> readAll(); @Nonnull Optional<Book> readByIsbn(@Nonnull final String isbn); @Nonnull Optional<Book> update(@Nonnull final Book bookToUpdate); boolean delete(@Nonnull final Book bookToDelete);  }