예제 #1
0
 @Test
 public void shouldReportErrorMessageWhenUserSelectsABookThatDoesNotExist() throws IOException {
   when(bufferedReader.readLine()).thenReturn("2", "100", "1", "0");
   when(library.checkOutBook(99)).thenReturn(false);
   when(library.checkOutBook(0)).thenReturn(true);
   bookList.add(harryPotter);
   menu.respondToUserInput(library);
   verify(printStream).println(contains("That book is not available."));
 }
예제 #2
0
 private void successfullyReturnBook() throws IOException {
   when(bufferedReader.readLine()).thenReturn("2", "1", "0");
   when(library.checkOutBook(0)).thenReturn(true);
 }