コード例 #1
0
  @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());
  }
コード例 #2
0
  @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());
  }