Esempio n. 1
0
 @Test
 public void testReturnBookNotOnLoan() {
   testingBook.setState(EBookState.DISPOSED);
   try {
     testingBook.returnBook(true);
     fail("Runtime Exception");
   } catch (RuntimeException e) {
     assertTrue(true);
   }
 }
Esempio n. 2
0
  @Test
  public void testReturnBookNotDamaged() {

    testingBook.setState(EBookState.ON_LOAN);

    when(mockLoan.getBook()).thenReturn(testingBook);

    assertEquals(testingBook.getState(), EBookState.ON_LOAN);

    testingBook.returnBook(false);

    assertEquals(testingBook.getState(), EBookState.AVAILABLE);
  }
Esempio n. 3
0
  @Test
  public void testReturnBookDamaged() {

    testingBook.setState(EBookState.ON_LOAN);

    when(mockLoan.getBook()).thenReturn(testingBook);

    assertEquals(testingBook.getState(), EBookState.ON_LOAN);

    testingBook.returnBook(true);

    assertEquals(testingBook.getState(), EBookState.DAMAGED);
  }