Skip to content

Instantly share code, notes, and snippets.

@nthx
Created December 17, 2011 03:27
Show Gist options
  • Save nthx/1489042 to your computer and use it in GitHub Desktop.
Save nthx/1489042 to your computer and use it in GitHub Desktop.
public void setUp()
{
Pat.unload();
removeDatabaseFiles();
world = new World();
library = world.getLibrary();
}
public void testLendBookToReader()
{
Book book = TestObjectFactory.addBookWithAuthor(world, "Java", "Author");
Copy copy = TestObjectFactory.addCopy(world, book, "S.2409");
Reader reader = TestObjectFactory.addStudent(world, "Nazar", "Tomasz");
assertEquals(0, reader.getCopies().getSize());
library.lendCopy(copy, reader, Dates.now(), Dates.nowPlus(14));
assertEquals(1, reader.getCopies().getSize());
assertEquals(reader, copy.getReader());
assertEquals(Dates.now(), copy.getLendDate());
assertEquals(Dates.nowPlus(14), copy.getReturnDate());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment