dtu.library.app
Class TestBorrowBook
java.lang.Object
dtu.library.app.SampleDataSetup
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
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 java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TestBorrowBook
public TestBorrowBook()
testBorrowBook
public void testBorrowBook()
throws java.lang.Exception
- Tests that the user can borrow a book.
- Retrieve the user by its CPR number
- Retrieve the book by its signature
- The user borrows the book
- 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.
- Retrieve the user by its CPR number
- Borrow 10 books
- Retrieve the book by its signature
- Borrow the 11th book
- 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.
- Get the user via his CPR number
- Call the borrowBook operation with the null value
- Check that the number of borrowed books has not changed
- Throws:
java.lang.Exception