@Test public void generatingRandomBooks_ReturnsNonEmptyBookList() { List<Book> books = new RandomBookGenerator().generate(15); assertEquals(15, books.size()); for (Book book : books) { assertNotNull(book.getTitle()); assertNotNull(book.getAuthor()); assertNotEquals(0, book.getPublishDate().getTime()); } }
public List<Book> generate(int howMany) { List<Book> books = new ArrayList<>(); for (int i = 0; i < howMany; i++) { books.add(randomBook()); } return books; }
RandomBookGenerator { public List<Book> generate(int howMany) { List<Book> books = new ArrayList<>(); for (int i = 0; i < howMany; i++) { books.add(randomBook()); } return books; } }
RandomBookGenerator { public List<Book> generate(int howMany) { List<Book> books = new ArrayList<>(); for (int i = 0; i < howMany; i++) { books.add(randomBook()); } return books; }  }
RandomBookGenerator { public List<Book> generate(int howMany) { List<Book> books = new ArrayList<>(); for (int i = 0; i < howMany; i++) { books.add(randomBook()); } return books; }  List<Book> generate(int howMany); Book randomBook(); }
RandomBookGenerator { public List<Book> generate(int howMany) { List<Book> books = new ArrayList<>(); for (int i = 0; i < howMany; i++) { books.add(randomBook()); } return books; }  List<Book> generate(int howMany); Book randomBook();  }