Ejemplo n.º 1
0
  @Test
  public void shouldReturnEntityByDocId() {
    Object value = mock(Object.class);
    String docId = "docId";
    when(crudRepository1.get(docId)).thenReturn(value);

    assertEquals(value, crudService.getEntity(entity1, docId));
  }
Ejemplo n.º 2
0
  @Test
  public void shouldDeleteEntity() {
    String docId = "docId";
    MotechBaseDataObject value = mock(MotechBaseDataObject.class);
    when(crudRepository1.get(docId)).thenReturn(value);

    crudService.deleteEntity(entity1, docId);

    verify(crudRepository1).remove(value);
    verify(crudEntity1).deleted(value);
  }