dtu.library.app
Class TestBorrowBook

java.lang.Object
  extended by dtu.library.app.SampleDataSetup
      extended by dtu.library.app.TestBorrowBook

public class TestBorrowBook
extends SampleDataSetup

This class contains the test for testing borrowing of books (and returning them). It includes also a test for the case that more then 10 books are borrowed by the same user. Note that the tests for overdue books is done in class TestOverdue.

Author:
hub
See Also:
TestOverdue

Constructor Summary
TestBorrowBook()
           
 
Method Summary
 void testBorrowBook()
          Tests that the user can borrow a book.
 void testBorrowBookMoreThan10()
          Test the case when the user has already borrowed 10 books and want to borrow one more.
 void testBorrowBookNull()
          Tests the case when the user tries to borrow the null value.
 
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

TestBorrowBook

public TestBorrowBook()
Method Detail

testBorrowBook

public void testBorrowBook()
                    throws java.lang.Exception
Tests that the user can borrow a book.
  1. Retrieve the user by its CPR number
  2. Retrieve the book by its signature
  3. The user borrows the book
  4. The book is in the list of books borrowed by that user

Throws:
java.lang.Exception

testBorrowBookMoreThan10

public void testBorrowBookMoreThan10()
                              throws java.lang.Exception
Test the case when the user has already borrowed 10 books and want to borrow one more.
  1. Retrieve the user by its CPR number
  2. Borrow 10 books
  3. Retrieve the book by its signature
  4. Borrow the 11th book
  5. A TooManyBooksException is thrown

Throws:
java.lang.Exception

testBorrowBookNull

public void testBorrowBookNull()
                        throws java.lang.Exception
Tests the case when the user tries to borrow the null value. This should be ignored.
  1. Get the user via his CPR number
  2. Call the borrowBook operation with the null value
  3. Check that the number of borrowed books has not changed

    Throws:
    java.lang.Exception