コード例 #1
0
  @Test
  public void testStoreCustomer() {

    when(customerRepository.save(customer)).thenReturn(customer);

    customerService.storeCustomer(customer);
  }
コード例 #2
0
  @Test
  public void testFindAll() {

    List<Customer> customers = new ArrayList<Customer>();
    customers.add(customer);

    when(customerRepository.findAll()).thenReturn(customers);

    assertEquals(1, customerService.findAll().size());
  }