Example #1
0
  @Test
  public void testFindAllWithClientServiceShouldPass() throws Exception {

    List<Client> clients = clientService.findAll();

    clientService.create(client);

    List<Client> result = clientService.findAll();

    assertThat(result.size(), is(clients.size() + 1));
  }
Example #2
0
  @Test
  public void testFindByIdWithClientServiceShouldPass() throws Exception {

    client.setName("test findById");
    clientService.create(client);
    Integer insertedId = client.getId();

    Client result = clientService.findById(insertedId);

    assertThat(result.getName(), is("test findById"));
  }
Example #3
0
  @Test
  public void testDeleteWithClientServiceShouldPass() throws Exception {

    clientService.create(client);
    Integer insertedId = client.getId();

    Client delete = clientService.findById(insertedId);
    clientService.delete(delete);

    Client result = clientService.findById(delete.getId());

    assertNull(result);
  }