### Question:
VendingMachine { public void insert(Coin money) { inserted.add(money); if (fullyPaid()) { giveProductAndReturnChange(); } else{ updateDisplayedPrice(); } } VendingMachine(ProductStorage storage, CoinDispenser coinDispenser, ProductFeeder productFeeder, PriceList priceList); String getDisplay(); void select(int shelfNumber); void insert(Coin money); void cancel();  }### Answer:
@Test public void shouldAcceptCoinsIfWholeAmmountHasBeenPaid() throws Exception { selectProductThatCost("1,50"); vendingMachine.insert(Coin.FIFTY_CENTS); vendingMachine.insert(Coin.ONE_DOLLAR); verify(coinDispenser).accept(Coin.FIFTY_CENTS, Coin.ONE_DOLLAR); }
@Test public void shouldReturnChangeIfAmmountPaidHasBeenLargerThanPrice() throws Exception { selectProductThatCost("1,50"); vendingMachine.insert(Coin.ONE_DOLLAR); vendingMachine.insert(Coin.ONE_DOLLAR); verify(coinDispenser).accept(Coin.ONE_DOLLAR, Coin.ONE_DOLLAR); verify(coinDispenser).giveBack(Price.of("0,50")); }
@Test public void shouldReturnWholeAmmountIfChangeCannotBeReturned() throws Exception { selectProductThatCost("1,50"); changeCannotBeReturned("0,50"); vendingMachine.insert(Coin.ONE_DOLLAR); vendingMachine.insert(Coin.ONE_DOLLAR); verify(coinDispenser).giveBack(Price.of("2,00")); }