RegisterPayment extends ResourceBase { @POST @Consumes(MediaType.APPLICATION_JSON) public Account doRegisterPayment(PerformedTransaction payment) { return ukelonn.registerPayment(payment); }  @POST @Consumes(MediaType.APPLICATION_JSON) Account doRegisterPayment(PerformedTransaction payment);  }
@Test public void testRegisterPayment() throws Exception { Account account = getJadAccount(); double originalBalance = account.getBalance(); account.setBalance(0.0); List<TransactionType> paymenttypes = getPaymenttypes(); PerformedTransaction payment = new PerformedTransaction(account, paymenttypes.get(0).getId(), account.getBalance(), new Date()); RegisterPayment resource = new RegisterPayment(); UkelonnService ukelonn = mock(UkelonnService.class); when(ukelonn.registerPayment(any())).thenReturn(account); resource.ukelonn = ukelonn; Account result = resource.doRegisterPayment(payment); assertEquals("jad", result.getUsername()); assertThat(result.getBalance()).isLessThan(originalBalance); }