### Question:
Holdings { Holdings remove(String symbol, int sharesToRemove) { if (sharesToRemove <= 0) { throw new IllegalArgumentException("Number of shares to remove from Holdings must be positive."); } if (holdings.containsKey(symbol)) { int currentShares = holdings.get(symbol); int remainingShares = currentShares - sharesToRemove; if (remainingShares > 0) { return new Holdings(holdings.plus(symbol, remainingShares)); } else if (remainingShares == 0) { return new Holdings(holdings.minus(symbol)); } else { throw new IllegalStateException("Attempt to remove more shares from Holdings than are currently available."); } } else { throw new IllegalStateException( String.format("Attempt to remove shares for symbol %s not contained in Holdings.", symbol)); } }    }### Answer:
@Test public void remove() { Holdings holdings = Holdings.EMPTY .add("ABC", 10) .remove("ABC", 8); assertEquals(holdings.getShareCount("ABC"), 2); }