class RepositoryTodoCrudService implements TodoCrudService {

    @Transactional
    @Override
    public TodoDTO update(TodoDTO dto) {
        LOGGER.info("Updating the information of a todo entry: {}", dto);

        Todo newInformation = createModel(dto);
        Todo updated = repository.update(newInformation);

        LOGGER.debug("Updated the information of a todo entry: {}", updated);

        return transformer.convert(updated, new TodoDTO());
    }

}

class RepositoryTodoCrudServiceTest {

    private static final String CREATION_TIME_STRING;
    private static final Timestamp CREATION_TIME;
    private static final String DESCRIPTION;
    private static final Long ID;
    private static final String MODIFICATION_TIME_STRING;
    private static final Timestamp MODIFICATION_TIME;
    private static final String TITLE;
    @Mock
    private TodoRepository repositoryMock;
    private RepositoryTodoCrudService service;
    @Autowired
    private JTransfo transformer;

    @Test
    public void update_TodoEntryNotFound_ShouldThrowException() {

        TodoDTO updatedTodoEntry = new TodoDTOBuilder()
                .id(ID)
                .description(DESCRIPTION)
                .title(TITLE)
                .build();

        when(repositoryMock.update(isA(Todo.class))).thenThrow(new TodoNotFoundException(""));

        catchException(service).update(updatedTodoEntry);
        assertThat(caughtException()).isExactlyInstanceOf(TodoNotFoundException.class);

        ArgumentCaptor<Todo> repositoryMethodArgument = ArgumentCaptor.forClass(Todo.class);

        verify(repositoryMock, times(1)).update(repositoryMethodArgument.capture());
        verifyNoMoreInteractions(repositoryMock);

        Todo repositoryMethodArgumentValue = repositoryMethodArgument.getValue();

        assertThatTodo(repositoryMethodArgumentValue)
                .hasDescription(DESCRIPTION)
                .hasId(ID)
                .hasTitle(TITLE)
                .creationTimeIsNotSet()
                .modificationTimeIsNotSet();
    }

}