@Test public void addToIndex_ShouldCreateNewDocument_ToIndex() { Todo todoEntry = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION, TodoTestUtil.TITLE); service.addToIndex(todoEntry); ArgumentCaptor<TodoDocument> todoDocumentArgument = ArgumentCaptor.forClass(TodoDocument.class); verify(repositoryMock, times(1)).save(todoDocumentArgument.capture()); verifyNoMoreInteractions(repositoryMock); TodoDocument todoDocument = todoDocumentArgument.getValue(); assertEquals(todoEntry.getId().toString(), todoDocument.getId()); assertEquals(todoEntry.getDescription(), todoDocument.getDescription()); assertEquals(todoEntry.getTitle(), todoDocument.getTitle()); }
@Transactional @Override public void addToIndex(Todo todoEntry) { LOGGER.debug("Saving a todo entry with information: {}", todoEntry); TodoDocument document = TodoDocument.getBuilder(todoEntry.getId(), todoEntry.getTitle()) .description(todoEntry.getDescription()) .build(); LOGGER.debug("Saving document with information: {}", document); repository.save(document); }
RepositoryTodoIndexService implements TodoIndexService { @Transactional @Override public void addToIndex(Todo todoEntry) { LOGGER.debug("Saving a todo entry with information: {}", todoEntry); TodoDocument document = TodoDocument.getBuilder(todoEntry.getId(), todoEntry.getTitle()) .description(todoEntry.getDescription()) .build(); LOGGER.debug("Saving document with information: {}", document); repository.save(document); } }
RepositoryTodoIndexService implements TodoIndexService { @Transactional @Override public void addToIndex(Todo todoEntry) { LOGGER.debug("Saving a todo entry with information: {}", todoEntry); TodoDocument document = TodoDocument.getBuilder(todoEntry.getId(), todoEntry.getTitle()) .description(todoEntry.getDescription()) .build(); LOGGER.debug("Saving document with information: {}", document); repository.save(document); }  }
RepositoryTodoIndexService implements TodoIndexService { @Transactional @Override public void addToIndex(Todo todoEntry) { LOGGER.debug("Saving a todo entry with information: {}", todoEntry); TodoDocument document = TodoDocument.getBuilder(todoEntry.getId(), todoEntry.getTitle()) .description(todoEntry.getDescription()) .build(); LOGGER.debug("Saving document with information: {}", document); repository.save(document); }  @Transactional @Override void addToIndex(Todo todoEntry); @Transactional @Override void deleteFromIndex(Long id); @Override List<TodoDocument> search(String searchTerm); @Transactional @Override void update(Todo todoEntry); }
RepositoryTodoIndexService implements TodoIndexService { @Transactional @Override public void addToIndex(Todo todoEntry) { LOGGER.debug("Saving a todo entry with information: {}", todoEntry); TodoDocument document = TodoDocument.getBuilder(todoEntry.getId(), todoEntry.getTitle()) .description(todoEntry.getDescription()) .build(); LOGGER.debug("Saving document with information: {}", document); repository.save(document); }  @Transactional @Override void addToIndex(Todo todoEntry); @Transactional @Override void deleteFromIndex(Long id); @Override List<TodoDocument> search(String searchTerm); @Transactional @Override void update(Todo todoEntry);  }