Skip to content

Commit

Permalink
checkstyle code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sergi-Jr committed Aug 16, 2024
1 parent 713e403 commit a6d1cd5
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/main/java/sergi/example/task/dal/TaskService.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public TaskService(TaskMapper mapper, TaskRepository repository) {

@Transactional
public TaskDTO update(Long id, TaskUpdateDTO data) {
Task model = taskRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Task not found: " + id));
Task model = taskRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Task not found: " + id));
taskMapper.update(data, model);
taskRepository.save(model);
return taskMapper.map(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/sergi/example/user/dal/UserRepository.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sergi.example.user.dal;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Repository;
import sergi.example.user.User;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/sergi/example/user/dal/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public UserDTO create(UserCreateDTO data) {

@Transactional
public UserDTO update(Long id, UserUpdateDTO data) {
User model = userRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("User not found, id: " + id));
User model = userRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("User not found, id: " + id));
userMapper.update(data, model);
userRepository.save(model);
return userMapper.map(model);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/utils/InitData.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package utils;

import lombok.RequiredArgsConstructor;
import net.datafaker.Faker;
import org.instancio.Instancio;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import sergi.example.task.Task;
import sergi.example.user.User;
Expand Down
1 change: 0 additions & 1 deletion src/test/java/sergi/example/api/TaskControllerTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sergi.example.api;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/sergi/example/api/UserControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ void testUpdate() throws Exception {
.containsEntry("email", actual.getEmail())
.containsEntry("name", actual.getName());
}
}
}

0 comments on commit a6d1cd5

Please sign in to comment.