Exemplo n.º 1
0
 public void testFindAvailableCopyReturnsNullWhenCopyIsBorrowed() throws Exception {
   gateway.addCopy(new Book("isbn2", "Peace and War", "Toy Story")).getId();
   List copies = gateway.findAllCopies("isbn2");
   MediaCopy copy = (MediaCopy) copies.get(0);
   copy.setLoaned(new LoanReceipt(new Patron(DateUtil.dateFromString("1/1/2000"))));
   assertEquals(null, gateway.findAvailableCopy("isbn2"));
 }
Exemplo n.º 2
0
  public void testFindAvailableCopyReturnsCopyWhenOneCopyOfManyIsBorrowed() throws Exception {
    gateway.addCopies(new Book("isbn1", "Peace and War 1", "Toy Story"), 2);

    List copies = gateway.findAllCopies("isbn1");
    MediaCopy copy = (MediaCopy) copies.get(0);
    copy.setLoaned(new LoanReceipt(new Patron(DateUtil.dateFromString("1/1/2000"))));
    assertNotNull(gateway.findAvailableCopy("isbn1"));
  }
Exemplo n.º 3
0
 public void testFindAvailableCopyShouldReturnNullIfNoSuchBook() throws Exception {
   assertNull(gateway.findAvailableCopy("noSuchBook"));
 }
Exemplo n.º 4
0
 public void testFindAvailableCopyReturnsCopyWhenCopyIsNotBorrowed() throws Exception {
   assertNotNull(gateway.findAvailableCopy("isbn"));
 }