@Test public void testObtainAvailableItems() { PortfolioView portfolio = createDefaultPortfolio(); assertEquals(AMOUNT_ITEMS - AMOUNT_RESERVED, portfolio.obtainAmountOfAvailableItemsFor(ORDER_BOOK_ID)); }
public long obtainAmountOfAvailableItemsFor(String orderBookId) { long possession = obtainAmountOfItemsInPossessionFor(orderBookId); long reserved = obtainAmountOfReservedItemsFor(orderBookId); return possession - reserved; }
PortfolioView { public long obtainAmountOfAvailableItemsFor(String orderBookId) { long possession = obtainAmountOfItemsInPossessionFor(orderBookId); long reserved = obtainAmountOfReservedItemsFor(orderBookId); return possession - reserved; } }
PortfolioView { public long obtainAmountOfAvailableItemsFor(String orderBookId) { long possession = obtainAmountOfItemsInPossessionFor(orderBookId); long reserved = obtainAmountOfReservedItemsFor(orderBookId); return possession - reserved; }  }
PortfolioView { public long obtainAmountOfAvailableItemsFor(String orderBookId) { long possession = obtainAmountOfItemsInPossessionFor(orderBookId); long reserved = obtainAmountOfReservedItemsFor(orderBookId); return possession - reserved; }  long obtainAmountOfAvailableItemsFor(String orderBookId); long obtainAmountOfReservedItemsFor(String orderBookId); long obtainAmountOfItemsInPossessionFor(String orderBookId); long obtainMoneyToSpend(); ItemEntry findReservedItemById(String orderBookId); ItemEntry findItemInPossession(String orderBookId); void addReservedItem(ItemEntry itemEntry); void addItemInPossession(ItemEntry itemEntry); void removeReservedItem(String itemId, long amount); void removeItemsInPossession(String itemID, long amount); String getIdentifier(); void setIdentifier(String identifier); String getUserId(); void setUserId(String userId); long getAmountOfMoney(); void setAmountOfMoney(long amountOfMoney); long getReservedAmountOfMoney(); void setReservedAmountOfMoney(long reservedAmountOfMoney); Map<String, ItemEntry> getItemsInPossession(); void setItemsInPossession(Map<String, ItemEntry> itemsInPossession); Map<String, ItemEntry> getItemsReserved(); void setItemsReserved(Map<String, ItemEntry> itemsReserved); @Override String toString(); }
PortfolioView { public long obtainAmountOfAvailableItemsFor(String orderBookId) { long possession = obtainAmountOfItemsInPossessionFor(orderBookId); long reserved = obtainAmountOfReservedItemsFor(orderBookId); return possession - reserved; }  long obtainAmountOfAvailableItemsFor(String orderBookId); long obtainAmountOfReservedItemsFor(String orderBookId); long obtainAmountOfItemsInPossessionFor(String orderBookId); long obtainMoneyToSpend(); ItemEntry findReservedItemById(String orderBookId); ItemEntry findItemInPossession(String orderBookId); void addReservedItem(ItemEntry itemEntry); void addItemInPossession(ItemEntry itemEntry); void removeReservedItem(String itemId, long amount); void removeItemsInPossession(String itemID, long amount); String getIdentifier(); void setIdentifier(String identifier); String getUserId(); void setUserId(String userId); long getAmountOfMoney(); void setAmountOfMoney(long amountOfMoney); long getReservedAmountOfMoney(); void setReservedAmountOfMoney(long reservedAmountOfMoney); Map<String, ItemEntry> getItemsInPossession(); void setItemsInPossession(Map<String, ItemEntry> itemsInPossession); Map<String, ItemEntry> getItemsReserved(); void setItemsReserved(Map<String, ItemEntry> itemsReserved); @Override String toString();  }