Dev#8
Conversation
| */ | ||
| @ExceptionHandler(EntityNotFoundException.class) | ||
| protected ResponseEntity<ApiErrorResponse> handleExecutorNotFoundExeption(EntityNotFoundException e, HttpServletRequest request) { | ||
| log.error(GENERATION_ERROR.getEnumDescription() + e.getClass() + LINE_FEED + e.getMessage() + LINE_FEED + e); |
There was a problem hiding this comment.
Вид логгера везде должен быть формата log.errror({})
Как пример:
log.error("{}{}" + LINE_FEED + "{}" + LINE_FEED + "{}", GENERATION_ERROR.getEnumDescription(), e.getClass(), e.getMessage(), e);
| public TaskDto convertTasksToDto(Task tasks) { | ||
| log.info("Метод convertTasksToDto()"); | ||
| TaskDto tasksDtoLocalObject = new TaskDto(); | ||
| if (tasks != null) { |
There was a problem hiding this comment.
Повтор кода, можно декомпозировать и вывести в отдельный метод
| @NotNull(message = "TasksDto не может быть null") TaskDto tasksDto) throws EntityNotFoundException { | ||
| Optional<TaskDto> newTasksDto = taskService | ||
| .changeTasks(tasksDto); | ||
| if (newTasksDto.isPresent()) { |
There was a problem hiding this comment.
Можно более краткую вариацию, если уже с Optional работаешь, пример:
return newTasksDto.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.badRequest().build());
В нескольких местах есть такое
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
| public class Violation { |
| spring.liquibase.enabled=true | ||
| spring.cache.type=redis | ||
| spring.redis.host=localhost | ||
| spring.redis.port=6379 |
There was a problem hiding this comment.
У тебя немного устаревший параметр
spring.data.redis.port
| @Autowired | ||
| private ObjectMapper objectMapper; | ||
|
|
||
| // Тесты для POST /task/create |
There was a problem hiding this comment.
Лишние комменты лучше не держать, есть JavaDoc лбо Display в данном случае
No description provided.