Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## dtu.library.app
Class TestOverdue

    java.lang.Object
      dtu.library.app.SampleDataSetup
          dtu.library.app.TestOverdue

    public class TestOverdue

extends SampleDataSetup

Constructor Summary
`TestOverdue()`

Method Summary
`void` | `testBorrowWithOverdueBooks()` Test that the user can't borrow a book if he has an overdue book.
`void` | `testOverdueBook()` Tests the overdue status of a book.
`void` | `testOverdueBookYearRollOver()` Tests that the computation of when a book is overdue also works across year boundaries (e.g.
`void` | `testReturningOverdueBook()` Tests that the book is not overdue anymore, when it is being returned.

Methods inherited from class dtu.library.app.SampleDataSetup
`setUp`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TestOverdue

    public TestOverdue()

Method Detail

### 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.
  1. Create a mock object for the date server and tell the library app to use that mock object
  2. Make sure that on borrowing the date server returns 15.1.2011
  3. Get a user by CPR number and a book by signature and let the user borrow the book
  4. Compute the date 28 days after the borrow date and set is as the new return value for the mock object
  5. Check that the book is not yet overdue
  6. Set the date 29 days after the borrow date
  7. 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.
  1. The user borrows a book
  2. The date is set to 29 days after the book has been borrowed
  3. The user tries to borrow another book
  4. 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.
  1. The user borrows a book
  2. The date is set to 29 days after borrowing
  3. Check that the book is overdue
  4. The user returns the book
  5. Check that the book is not overdue anymore

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD