InventorySystem { public void reserve(String sku, int quantity) throws InsufficientInventoryException { if (isOnStock(sku, quantity)) inventory.put(sku, inventory.get(sku) - quantity); else throw new InsufficientInventoryException(); logger.info("There is still " + inventory.get(sku) + " of " + sku + " left in inventory"); }  void reserve(String sku, int quantity); boolean isOnStock(String sku, int quantity);  }
@Test(expected = InsufficientInventoryException.class) public void youCannotBuyMoreThanAvailableInTheInventory() throws Exception { inventorySystem.reserve("Frikandel", 21); }