Junkomat { public ProductAndRest buyProduct(Code selection, Coins payedCoins) { ProductInfo product = getProductInStock(selection); Coins restCoins = moneyMachine.acceptPayment(product.getPriceInCents(), payedCoins); product.decreaseStock(); return new ProductAndRest(product.getName(), restCoins); }  void refillMoney(Coins coins); ProductAndRest buyProduct(Code selection, Coins payedCoins); int sumTotalCents(); void refillProducts(Map<Code, ProductInfo> products); int sumTotalProducts();  }
@Test(expected = IllegalArgumentException.class) public void invalidSelection() { junkomat.buyProduct(new Code(1), new Coins(Coin.TWENTY_CENTS)); }