### Question:
PaymentsResource { @PostMapping("/payments/{id}") public ResponseEntity<Void> create(@PathVariable String id, @RequestBody PaymentIntent intent) throws URISyntaxException { intent.setId(id); createPaymentCommand.accept(intent); return ResponseEntity.created(new URI("/payments/" + id)).build(); } PaymentsResource(Consumer<PaymentIntent> createPaymentCommand); @PostMapping("/payments/{id}") ResponseEntity<Void> create(@PathVariable String id, @RequestBody PaymentIntent intent);  }### Answer:
@Test public void delegate() throws URISyntaxException { PaymentIntent intent = new PaymentIntent(BigDecimal.TEN, Currency.getInstance("EUR")); context.checking(new Expectations() {{ oneOf(createPaymentCommand).accept(intent); }}); resource.create("MYPAYMENT-1234", intent); }