### Question:
Inventory { public void addPurchase(Purchase p) { mPurchaseMap.put(p.getSku(), p); }  SkuDetails getSkuDetails(String sku); Collection<SkuDetails> getSkuDetails(); Purchase getPurchase(String sku); boolean hasPurchase(String sku); boolean hasDetails(String sku); void erasePurchase(String sku); List<String> getAllOwnedSkus(); List<String> getAllOwnedSkus(ItemType itemType); List<Purchase> getAllPurchases(); void addSkuDetails(SkuDetails d); void addPurchase(Purchase p); @Override String toString();  }### Answer:
@Test public void testAddPurchase() throws Exception { Inventory inventory = new Inventory(); inventory.addPurchase(mock(Purchase.class)); assertThat(inventory.getAllPurchases()).hasSize(1); }