### Question:
VendingMachineController { @RequestMapping( value = "/vending-machine/insert", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") public @ResponseBody Response insertCoin(@RequestBody String coin) { try{ vendingMachine.insert(Coin.valueOf(coin)); return Response.success(); } catch (IllegalArgumentException e) { return Response.failure(String.format("Invalid argument: '%s'", coin)); } catch (Exception e) { return Response.failure(e.getMessage()); } } @Autowired  VendingMachineController(VendingMachine vendingMachine, ProductStorage productStorage); @RequestMapping("/") String index(); @RequestMapping("/vending-machine") String page(); @RequestMapping( value = "/vending-machine/push", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") @ResponseBody Response selectProduct(@RequestBody Integer shelfNumber); @RequestMapping( value = "/vending-machine/insert", method = RequestMethod.POST, consumes = "application/json", produces = "application/json") @ResponseBody Response insertCoin(@RequestBody String coin); @RequestMapping( value = "/vending-machine/state", method = RequestMethod.GET, produces = "application/json") @ResponseBody VendingMachineDTO state();  }### Answer:
@Test public void shouldInsertCoin() throws Exception { controller.insertCoin("ONE_DOLLAR"); verify(vendingMachine).insert(Coin.ONE_DOLLAR); }
@Test public void shouldReturnSuccessForInsertCoin() throws Exception { Response response = controller.insertCoin("ONE_DOLLAR"); assertThat(response).isEqualTo(Response.success()); }
@Test public void shouldReturnFailureForInsertCoin() throws Exception { Response response = controller.insertCoin("INVALID_COIN"); assertThat(response).isEqualTo(Response.failure("Invalid argument: 'INVALID_COIN'")); }