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"));
 }
  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"));
  }
 public void testFindAvailableCopyShouldReturnNullIfNoSuchBook() throws Exception {
   assertNull(gateway.findAvailableCopy("noSuchBook"));
 }
 public void testFindAvailableCopyReturnsCopyWhenCopyIsNotBorrowed() throws Exception {
   assertNotNull(gateway.findAvailableCopy("isbn"));
 }