From 1e7a38332f15e650a80a7a78ba49dc74c7f8a4a3 Mon Sep 17 00:00:00 2001 From: Miguel Lehmann Date: Tue, 7 Jan 2025 11:14:45 +0100 Subject: [PATCH] backend formatting changes --- .../business/CompletedBusinessService.java | 4 ++-- .../okr/controller/CompletedControllerIT.java | 17 +++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java b/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java index 67520aedcb..fe5bfcb4b5 100644 --- a/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java +++ b/backend/src/main/java/ch/puzzle/okr/service/business/CompletedBusinessService.java @@ -1,5 +1,7 @@ package ch.puzzle.okr.service.business; +import static org.springframework.http.HttpStatus.NOT_FOUND; + import ch.puzzle.okr.exception.OkrResponseStatusException; import ch.puzzle.okr.models.Completed; import ch.puzzle.okr.service.persistence.CompletedPersistenceService; @@ -7,8 +9,6 @@ import jakarta.transaction.Transactional; import org.springframework.stereotype.Service; -import static org.springframework.http.HttpStatus.NOT_FOUND; - @Service public class CompletedBusinessService { private final CompletedPersistenceService completedPersistenceService; diff --git a/backend/src/test/java/ch/puzzle/okr/controller/CompletedControllerIT.java b/backend/src/test/java/ch/puzzle/okr/controller/CompletedControllerIT.java index 257f8f0346..c22b047fa7 100644 --- a/backend/src/test/java/ch/puzzle/okr/controller/CompletedControllerIT.java +++ b/backend/src/test/java/ch/puzzle/okr/controller/CompletedControllerIT.java @@ -4,6 +4,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.Mockito.doThrow; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; @@ -33,13 +34,6 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.web.server.ResponseStatusException; -import static ch.puzzle.okr.test.KeyResultTestHelpers.JSON_PATH_ID; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.Mockito.doThrow; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; - @WithMockUser(value = "spring") @ExtendWith(MockitoExtension.class) @WebMvcTest(CompletedController.class) @@ -133,7 +127,8 @@ void deleteShouldThrowExceptionWhenCompletedWithIdCantBeFound() throws Exception @DisplayName("get() should get Completed by Objective id") @Test void shouldGetMetricCompletedWithId() throws Exception { - mvc.perform(get("/api/v2/completed/1").with(SecurityMockMvcRequestPostProcessors.csrf())) + mvc + .perform(get("/api/v2/completed/1").with(SecurityMockMvcRequestPostProcessors.csrf())) .andExpect(MockMvcResultMatchers.status().isOk()); } @@ -141,9 +136,11 @@ void shouldGetMetricCompletedWithId() throws Exception { @Test void getShouldThrowExceptionWhenCompletedWithIdCantBeFound() throws Exception { doThrow(new ResponseStatusException(HttpStatus.NOT_FOUND, "Completed not found")) - .when(completedAuthorizationService).getCompletedByObjectiveId(anyLong()); + .when(completedAuthorizationService) + .getCompletedByObjectiveId(anyLong()); - mvc.perform(get("/api/v2/completed/1000").with(SecurityMockMvcRequestPostProcessors.csrf())) + mvc + .perform(get("/api/v2/completed/1000").with(SecurityMockMvcRequestPostProcessors.csrf())) .andExpect(MockMvcResultMatchers.status().isNotFound()); } }