Exemplo n.º 1
0
 public void testGetAllISBNsDoesNotIncludeCompactDiscs() {
   gateway.addCopies(
       new CompactDisc("abcd", "Peace and War, The Musical", "Gilbertolov and Sullivanalov"), 2);
   gateway.addCopies(new CompactDisc("xyz", "The White Album", "The Beatles"), 2);
   Map isbnsTitles = gateway.findAllISBNsAndTitles();
   assertEquals(1, isbnsTitles.size());
   assertEquals(6, gateway.copyCount());
 }
Exemplo n.º 2
0
 public void testGetAllISBNsAndTitles() {
   gateway.addCopy(new Book("isbn2", "Peace and War", "Toy Story")).getId();
   gateway.addCopy(new Book("isbn3", "Son of Peace and War", "Toy Story II")).getId();
   Map isbnsTitles = gateway.findAllISBNsAndTitles();
   assertEquals(3, isbnsTitles.size());
   Iterator iter = isbnsTitles.entrySet().iterator();
   while (iter.hasNext()) {
     Entry entry = (Entry) iter.next();
     assertTrue(((String) entry.getKey()).startsWith("isbn"));
     assertTrue(((String) entry.getValue()).contains("Peace"));
   }
 }