@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); }
@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); }
@Test public void repair() { testingBook.setState(EBookState.DAMAGED); assertEquals(testingBook.getState(), EBookState.DAMAGED); testingBook.repair(); }
@Test public void testLose() { testingBook.setState(EBookState.LOST); when(mockLoan.getBook()).thenReturn(testingBook); assertEquals(testingBook.getState(), EBookState.LOST); }
@Test public void testGetLoan() { testingBook.setState(EBookState.ON_LOAN); when(mockLoan.getBook()).thenReturn(testingBook); when(mockLoan.isOverDue()).thenReturn(false); assertEquals(testingBook.getState(), EBookState.ON_LOAN); }
@Test public void dispose() { testingBook.setState(EBookState.DISPOSED); assertEquals(testingBook.getState(), EBookState.DISPOSED); }