@Override public void doOperation() { console.display("Enter return book title: "); String booktitle = console.getUserInput(); Book book = new Book(booktitle, "UNKNOWN_AUTHOR", UNKNOWN_YEAR); String returnMessage = library.returnBook(book, user); console.display(returnMessage); }
@Test public void shouldCheckOutUnsuccessfullyFromLibraryIfBookNotExists() { when(console.getUserInput()).thenReturn("Head"); checkOutOption.doOperation(); verify(console).display("That book is not available\n"); }
@Test public void shouldCheckOutBookSuccessfullyFromLibraryIfBookExists() { when(console.getUserInput()).thenReturn("Head First Java"); checkOutOption.doOperation(); verify(console).display("Thank you ! Enjoy the book\n"); }
@Test public void shouldAskForBookTitle() { when(console.getUserInput()).thenReturn("Head First Java"); checkOutOption.doOperation(); verify(console).display("Enter booktitle to checkout: "); }
private String getUserLibraryNumber(Console console) { console.show(INPUT_YOUR_LIBRARY_NUMBER); return console.getUserInput(); }
private String getUserInputPassword(Console console) { console.show(INPUT_YOUR_PASSWORD); return console.getUserInput(); }