dtu.library.app
Class TestOverdue
java.lang.Object
dtu.library.app.SampleDataSetup
dtu.library.app.TestOverdue
public class TestOverdue
- extends SampleDataSetup
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TestOverdue
public TestOverdue()
testOverdueBook
public void testOverdueBook()
throws java.lang.Exception
- Tests the overdue status of a book. A book is overdue, when it is borrowed and
the current date is more than 28 days (4 weeks) later than the borrow date.
- Create a mock object for the date server and tell the library app to use that mock object
- Make sure that on borrowing the date server returns 15.1.2011
- Get a user by CPR number and a book by signature and let the user borrow the book
- Compute the date 28 days after the borrow date and set is as the new return value for the mock object
- Check that the book is not yet overdue
- Set the date 29 days after the borrow date
- Check that the book is overdue
- Throws:
java.lang.Exception
testOverdueBookYearRollOver
public void testOverdueBookYearRollOver()
throws java.lang.Exception
- Tests that the computation of when a book is overdue also works across year
boundaries (e.g. borrow date in 2010 and last return date is 2011)
- Throws:
java.lang.Exception
testBorrowWithOverdueBooks
public void testBorrowWithOverdueBooks()
throws java.lang.Exception
- Test that the user can't borrow a book if he has an overdue book.
- The user borrows a book
- The date is set to 29 days after the book has been borrowed
- The user tries to borrow another book
- The system throws a HasOverdueBooksException
- Throws:
java.lang.Exception
testReturningOverdueBook
public void testReturningOverdueBook()
throws java.lang.Exception
- Tests that the book is not overdue anymore, when it is being returned.
- The user borrows a book
- The date is set to 29 days after borrowing
- Check that the book is overdue
- The user returns the book
- Check that the book is not overdue anymore
- Throws:
java.lang.Exception