@Test public void updateAmount_ok() { Long customerNumber = 455L; String checkNumber = "IR662429"; BigDecimal a1 = new BigDecimal("32239.47"); Integer u1 = paymentService.updateAmount(customerNumber, checkNumber, a1); assertThat(u1, is(1)); Payment p1 = paymentService.findByPk(customerNumber, checkNumber); assertThat(p1, notNullValue()); assertThat(p1.getAmount(), is(a1)); System.out.println(p1.toString()); BigDecimal a2 = new BigDecimal("77777.88"); Integer u2 = paymentService.updateAmount(customerNumber, checkNumber, a2); assertThat(u2, is(1)); Payment p2 = paymentService.findByPk(customerNumber, checkNumber); assertThat(p2, notNullValue()); assertThat(p2.getAmount(), is(a2)); System.out.println(p2.toString()); }
@Test public void save_ok() { Payment result = paymentService.save(payment1); assertThat(result, notNullValue()); Payment actual = paymentService.findById(result.getId()); assertThat(actual, is(result)); payment1.setId(actual.getId()); }
@Test public void saveAll_ok() { List<Payment> payments = paymentService.saveAll(Arrays.asList(payment2, payment3)); assertThat(payments, notNullValue()); Payment actual2 = paymentService.findById(payments.get(0).getId()); Payment actual3 = paymentService.findById(payments.get(1).getId()); assertThat(actual2, is(payments.get(0))); assertThat(actual3, is(payments.get(1))); payment2.setId(actual2.getId()); payment3.setId(actual3.getId()); }
private void clear() { paymentService.removeAll(Arrays.asList(payment1, payment2, payment3)); }