Exemplo n.º 1
0
  @Test
  public void shouldDisplayFormattedTimeWhenFormattedTimeIsAnEmptyString() {

    createBooksPrintStreamDateTimeAndLibrary();
    when(dateTimeFormatter.print(time)).thenReturn("");
    library.welcome(time);
    verify(printStream).println(contains("The current time is "));
  }
Exemplo n.º 2
0
 // This one is done for you
 @Test
 public void shouldWelcomeUser() {
   // We don't need to mock DateTime because it is a value object
   // We can't mock it because it is a final class
   createBooksPrintStreamDateTimeAndLibrary();
   library.welcome(time);
   verify(printStream).println(contains("Welcome"));
 }