diff --git a/src/main/java/org/ays/common/exception/handler/GlobalExceptionHandler.java b/src/main/java/org/ays/common/exception/handler/GlobalExceptionHandler.java index 10f144900..b73215fd7 100644 --- a/src/main/java/org/ays/common/exception/handler/GlobalExceptionHandler.java +++ b/src/main/java/org/ays/common/exception/handler/GlobalExceptionHandler.java @@ -92,11 +92,11 @@ AysErrorResponse handleNotExistError(final AysNotExistException exception) { @ExceptionHandler(AysConflictException.class) @ResponseStatus(HttpStatus.CONFLICT) - AysErrorResponse handleAlreadyExistError(final AysConflictException exception) { + AysErrorResponse handleConflictError(final AysConflictException exception) { log.error(exception.getMessage(), exception); return AysErrorResponse.builder() - .header(AysErrorResponse.Header.ALREADY_EXIST.getName()) + .header(AysErrorResponse.Header.CONFLICT_ERROR.getName()) .message(exception.getMessage()) .build(); } diff --git a/src/main/java/org/ays/common/model/response/AysErrorResponse.java b/src/main/java/org/ays/common/model/response/AysErrorResponse.java index 1e9d29608..8bd25034f 100644 --- a/src/main/java/org/ays/common/model/response/AysErrorResponse.java +++ b/src/main/java/org/ays/common/model/response/AysErrorResponse.java @@ -99,9 +99,9 @@ public enum Header { */ API_ERROR("API ERROR"), /** - * ALREADY_EXIST header. + * CONFLICT_ERROR header. */ - ALREADY_EXIST("ALREADY EXIST"), + CONFLICT_ERROR("CONFLICT ERROR"), /** * NOT_FOUND header. */ diff --git a/src/test/java/org/ays/auth/controller/AdminRegistrationApplicationEndToEndTest.java b/src/test/java/org/ays/auth/controller/AdminRegistrationApplicationEndToEndTest.java index 2ce047830..3a7d10961 100644 --- a/src/test/java/org/ays/auth/controller/AdminRegistrationApplicationEndToEndTest.java +++ b/src/test/java/org/ays/auth/controller/AdminRegistrationApplicationEndToEndTest.java @@ -518,7 +518,7 @@ void givenValidAdminRegistrationApplicationId_whenApproveAdminRegistrationApplic MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders .post(endpoint, superAdminToken.getAccessToken()); - AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.ALREADY_EXIST; + AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.CONFLICT_ERROR; aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse) .andExpect(AysMockResultMatchersBuilders.status() @@ -555,7 +555,7 @@ void givenValidAdminRegistrationApplicationId_whenApproveAdminRegistrationApplic MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders .post(endpoint, superAdminToken.getAccessToken()); - AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.ALREADY_EXIST; + AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.CONFLICT_ERROR; aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse) .andExpect(AysMockResultMatchersBuilders.status() @@ -739,7 +739,7 @@ void givenValidAdminRegistrationApplicationRejectRequest_whenRejectAdminRegistra MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders .post(endpoint, superAdminToken.getAccessToken(), rejectRequest); - AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.ALREADY_EXIST; + AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.CONFLICT_ERROR; aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse) .andExpect(AysMockResultMatchersBuilders.status() @@ -779,7 +779,7 @@ void givenValidAdminRegistrationApplicationRejectRequest_whenRejectAdminRegistra MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders .post(endpoint, superAdminToken.getAccessToken(), rejectRequest); - AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.ALREADY_EXIST; + AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.CONFLICT_ERROR; aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse) .andExpect(AysMockResultMatchersBuilders.status() diff --git a/src/test/java/org/ays/auth/controller/AysRoleControllerTest.java b/src/test/java/org/ays/auth/controller/AysRoleControllerTest.java index 53d4ccceb..a63065f2a 100644 --- a/src/test/java/org/ays/auth/controller/AysRoleControllerTest.java +++ b/src/test/java/org/ays/auth/controller/AysRoleControllerTest.java @@ -898,7 +898,7 @@ void givenValidIdForPassivation_whenRoleUsing_thenReturnConflict() throws Except MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders .patch(endpoint, mockSuperAdminToken.getAccessToken()); - AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.ALREADY_EXIST; + AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.CONFLICT_ERROR; aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse) .andExpect(AysMockResultMatchersBuilders.status() @@ -986,7 +986,7 @@ void givenValidId_whenRoleAlreadyDeleted_thenReturnConflict() throws Exception { MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders .delete(endpoint, mockAdminToken.getAccessToken()); - AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.ALREADY_EXIST; + AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.CONFLICT_ERROR; aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse) .andExpect(AysMockResultMatchersBuilders.status() @@ -1014,7 +1014,7 @@ void givenValidId_whenRoleUsing_thenReturnConflict() throws Exception { MockHttpServletRequestBuilder mockHttpServletRequestBuilder = AysMockMvcRequestBuilders .delete(endpoint, mockAdminToken.getAccessToken()); - AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.ALREADY_EXIST; + AysErrorResponse mockErrorResponse = AysErrorResponseBuilder.CONFLICT_ERROR; aysMockMvc.perform(mockHttpServletRequestBuilder, mockErrorResponse) .andExpect(AysMockResultMatchersBuilders.status() diff --git a/src/test/java/org/ays/common/model/response/AysErrorResponseBuilder.java b/src/test/java/org/ays/common/model/response/AysErrorResponseBuilder.java index 64605d321..cdc23ac66 100644 --- a/src/test/java/org/ays/common/model/response/AysErrorResponseBuilder.java +++ b/src/test/java/org/ays/common/model/response/AysErrorResponseBuilder.java @@ -14,8 +14,8 @@ public class AysErrorResponseBuilder { .header(AysErrorResponse.Header.AUTH_ERROR.getName()) .isSuccess(false).build(); - public static final AysErrorResponse ALREADY_EXIST = AysErrorResponse.builder() - .header(AysErrorResponse.Header.ALREADY_EXIST.getName()) + public static final AysErrorResponse CONFLICT_ERROR = AysErrorResponse.builder() + .header(AysErrorResponse.Header.CONFLICT_ERROR.getName()) .isSuccess(false).build(); public static final AysErrorResponse NOT_FOUND = AysErrorResponse.builder()