From 9f3e30f8130ffde07ddc60bf6860cb2866a3887a Mon Sep 17 00:00:00 2001 From: Kaiser-Yang <624626089@qq.com> Date: Fri, 13 Sep 2024 17:30:12 +0800 Subject: [PATCH 1/2] Add function for checking the info validity We add two APIs for checking the info validity, one is for checking the username, the other is for checking the email. See #32. --- .../cmipt/gcs/constant/ApiPathConstant.java | 4 +- .../cmipt/gcs/controller/UserController.java | 92 ++++++++++++++++++- .../cmipt/gcs/enumeration/ErrorCodeEnum.java | 1 + .../gcs/exception/GlobalExceptionHandler.java | 37 ++++++-- .../java/edu/cmipt/gcs/filter/JwtFilter.java | 7 +- src/main/resources/message/message.properties | 1 + .../gcs/controller/UserControllerTest.java | 54 +++++++++++ 7 files changed, 184 insertions(+), 12 deletions(-) diff --git a/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java b/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java index 0ed2cb9..750b89d 100644 --- a/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java +++ b/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java @@ -20,5 +20,7 @@ public class ApiPathConstant { public static final String USER_API_PREFIX = ALL_API_PREFIX + "/user"; - public static final String USER_GET_BY_NAME_API_PATH = USER_API_PREFIX + "/{username}"; + public static final String USER_GET_USER_BY_NAME_API_PATH = USER_API_PREFIX + "/{username}"; + public static final String USER_CHECK_EMAIL_VALIDITY_API_PATH = USER_API_PREFIX + "/email"; + public static final String USER_CHECK_USERNAME_VALIDITY_API_PATH = USER_API_PREFIX + "/username"; } diff --git a/src/main/java/edu/cmipt/gcs/controller/UserController.java b/src/main/java/edu/cmipt/gcs/controller/UserController.java index dbe0b9a..4653c42 100644 --- a/src/main/java/edu/cmipt/gcs/controller/UserController.java +++ b/src/main/java/edu/cmipt/gcs/controller/UserController.java @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import edu.cmipt.gcs.constant.ApiPathConstant; +import edu.cmipt.gcs.constant.HeaderParameter; +import edu.cmipt.gcs.constant.ValidationConstant; import edu.cmipt.gcs.enumeration.ErrorCodeEnum; import edu.cmipt.gcs.exception.GenericException; import edu.cmipt.gcs.pojo.error.ErrorVO; @@ -11,27 +13,51 @@ import edu.cmipt.gcs.service.UserService; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +@Validated @RestController @Tag(name = "User", description = "User Related APIs") public class UserController { @Autowired private UserService userService; - @GetMapping(ApiPathConstant.USER_GET_BY_NAME_API_PATH) + @GetMapping(ApiPathConstant.USER_GET_USER_BY_NAME_API_PATH) @Operation( summary = "Get user by name", description = "Get user information by user name", tags = {"User", "Get Method"}) + @Parameters({ + @Parameter( + name = HeaderParameter.TOKEN, + description = "Access token", + required = true, + in = ParameterIn.HEADER, + schema = @Schema(implementation = String.class)), + @Parameter( + name = "username", + description = "User name", + example = "admin", + required = true, + in = ParameterIn.PATH, + schema = @Schema(implementation = String.class)) + }) @ApiResponses({ @ApiResponse(responseCode = "200", description = "User information returned successfully"), @ApiResponse( @@ -47,4 +73,68 @@ public UserVO getUserByName(@PathVariable("username") String username) { } return new UserVO(userService.getOne(wrapper)); } + + @GetMapping(ApiPathConstant.USER_CHECK_EMAIL_VALIDITY_API_PATH) + @Operation( + summary = "Check email validity", + description = "Check if the email is valid", + tags = {"User", "Get Method"}) + @Parameter( + name = "email", + description = "Email", + example = "admin@cmipt.edu", + required = true, + in = ParameterIn.QUERY, + schema = @Schema(implementation = String.class)) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "Email validity checked successfully"), + @ApiResponse( + responseCode = "403", + description = "Email is invalid", + content = @Content(schema = @Schema(implementation = ErrorVO.class))) + }) + public void checkEmailValidity(@RequestParam("email") + @Email(message = "USERDTO_EMAIL_EMAIL {UserDTO.email.Email}") + @NotBlank(message = "USERDTO_EMAIL_NOTBLANK {UserDTO.email.NotBlank}") + String email) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("email", email); + if (userService.exists(wrapper)) { + throw new GenericException(ErrorCodeEnum.EMAIL_ALREADY_EXISTS, email); + } + } + + @GetMapping(ApiPathConstant.USER_CHECK_USERNAME_VALIDITY_API_PATH) + @Operation( + summary = "Check username validity", + description = "Check if the username is valid", + tags = {"User", "Get Method"}) + @Parameter( + name = "username", + description = "User name", + example = "admin", + required = true, + in = ParameterIn.QUERY, + schema = @Schema(implementation = String.class)) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "Username validity checked successfully"), + @ApiResponse( + responseCode = "403", + description = "Username is not valid", + content = @Content(schema = @Schema(implementation = ErrorVO.class))) + }) + public void checkUsernameValidity(@RequestParam("username") + @Size( + min = ValidationConstant.MIN_USERNAME_LENGTH, + max = ValidationConstant.MAX_USERNAME_LENGTH, + message = "USERDTO_USERNAME_SIZE {UserDTO.username.Size}") + @NotBlank( + message = "USERDTO_USERNAME_NOTBLANK {UserDTO.username.NotBlank}") + String username) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("username", username); + if (userService.exists(wrapper)) { + throw new GenericException(ErrorCodeEnum.USERNAME_ALREADY_EXISTS, username); + } + } } diff --git a/src/main/java/edu/cmipt/gcs/enumeration/ErrorCodeEnum.java b/src/main/java/edu/cmipt/gcs/enumeration/ErrorCodeEnum.java index 7e0c49d..2b87265 100644 --- a/src/main/java/edu/cmipt/gcs/enumeration/ErrorCodeEnum.java +++ b/src/main/java/edu/cmipt/gcs/enumeration/ErrorCodeEnum.java @@ -22,6 +22,7 @@ public enum ErrorCodeEnum { INVALID_TOKEN("INVALID_TOKEN"), ACCESS_DENIED("ACCESS_DENIED"), + TOKEN_NOT_FOUND("TOKEN_NOT_FOUND"), MESSAGE_CONVERSION_ERROR("MESSAGE_CONVERSION_ERROR"), diff --git a/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java b/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java index 8307e65..7fb17ec 100644 --- a/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java +++ b/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java @@ -4,6 +4,7 @@ import edu.cmipt.gcs.pojo.error.ErrorVO; import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.ConstraintViolationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,15 +36,23 @@ public class GlobalExceptionHandler { @ExceptionHandler(MethodArgumentNotValidException.class) public ResponseEntity handleMethodArgumentNotValidException( MethodArgumentNotValidException e, HttpServletRequest request) { - // we only handle one validation message - String codeAndMessage = e.getFieldError().getDefaultMessage(); - int firstSpaceIndex = codeAndMessage.indexOf(" "); - // There must be a space and not at the end of the message - assert firstSpaceIndex != -1; - assert firstSpaceIndex != codeAndMessage.length() - 1; - var exception = new GenericException(codeAndMessage.substring(firstSpaceIndex + 1)); - exception.setCode(ErrorCodeEnum.valueOf(codeAndMessage.substring(0, firstSpaceIndex))); - return handleGenericException(exception, request); + return handleValidationException(e.getFieldError().getDefaultMessage(), request); + } + + /** + * Handles ConstraintViolationException + * + *

+ * This method is used to handle the ConstraintViolationException, which is + * thrown when the + * validation of the path variables or request parameters fails. + * + * @param e ConstraintViolationException + */ + @ExceptionHandler(ConstraintViolationException.class) + public ResponseEntity handleConstraintViolationException( + ConstraintViolationException e, HttpServletRequest request) { + return handleValidationException(e.getConstraintViolations().iterator().next().getMessage(), request); } @ExceptionHandler(HttpMessageNotReadableException.class) @@ -78,4 +87,14 @@ public ResponseEntity handleGenericException( public void handleException(Exception e) { logger.error(e.getMessage()); } + + private ResponseEntity handleValidationException(String codeAndMessage, HttpServletRequest request) { + int firstSpaceIndex = codeAndMessage.indexOf(" "); + // There must be a space and not at the end of the message + assert firstSpaceIndex != -1; + assert firstSpaceIndex != codeAndMessage.length() - 1; + var exception = new GenericException(codeAndMessage.substring(firstSpaceIndex + 1)); + exception.setCode(ErrorCodeEnum.valueOf(codeAndMessage.substring(0, firstSpaceIndex))); + return handleGenericException(exception, request); + } } diff --git a/src/main/java/edu/cmipt/gcs/filter/JwtFilter.java b/src/main/java/edu/cmipt/gcs/filter/JwtFilter.java index e6dff20..11d812a 100644 --- a/src/main/java/edu/cmipt/gcs/filter/JwtFilter.java +++ b/src/main/java/edu/cmipt/gcs/filter/JwtFilter.java @@ -37,7 +37,9 @@ public class JwtFilter extends OncePerRequestFilter { ApiPathConstant.AUTHENTICATION_SIGN_IN_API_PATH, ApiPathConstant.AUTHENTICATION_SIGN_OUT_API_PATH, ApiPathConstant.DEVELOPMENT_GET_API_MAP_API_PATH, - ApiPathConstant.DEVELOPMENT_GET_ERROR_MESSAGE_API_PATH); + ApiPathConstant.DEVELOPMENT_GET_ERROR_MESSAGE_API_PATH, + ApiPathConstant.USER_CHECK_EMAIL_VALIDITY_API_PATH, + ApiPathConstant.USER_CHECK_USERNAME_VALIDITY_API_PATH); @Override protected void doFilterInternal( @@ -55,6 +57,9 @@ protected void doFilterInternal( } private void authorize(HttpServletRequest request, String token) { + if (token == null) { + throw new GenericException(ErrorCodeEnum.TOKEN_NOT_FOUND); + } switch (JwtUtil.getTokenType(token)) { case ACCESS_TOKEN: // ACCESS_TOKEN can not be used for refresh diff --git a/src/main/resources/message/message.properties b/src/main/resources/message/message.properties index 59f253d..d226078 100644 --- a/src/main/resources/message/message.properties +++ b/src/main/resources/message/message.properties @@ -17,6 +17,7 @@ EMAIL_ALREADY_EXISTS=Email already exists: {} WRONG_SIGN_IN_INFORMATION=Wrong sign in information INVALID_TOKEN=Invalid token: {} +TOKEN_NOT_FOUND=Token not found in header ACCESS_DENIED=Operation without privileges MESSAGE_CONVERSION_ERROR=Error occurs while converting message diff --git a/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java b/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java index 01cbe9f..5d111f7 100644 --- a/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java +++ b/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java @@ -6,6 +6,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import java.util.Date; + import edu.cmipt.gcs.constant.ApiPathConstant; import edu.cmipt.gcs.constant.HeaderParameter; import edu.cmipt.gcs.constant.TestConstant; @@ -62,4 +64,56 @@ public void testGetUserByNameInvalid() throws Exception { ErrorCodeEnum.USER_NOT_FOUND, invalidUsername)))); } + + @Test + public void testCheckEmailValidityExists() throws Exception { + mvc.perform( + get(ApiPathConstant.USER_CHECK_EMAIL_VALIDITY_API_PATH) + .param("email", TestConstant.EMAIL)) + .andExpectAll(status().isBadRequest(), content().json( + """ + { + "code": %d, + "message": "%s" + } + """.formatted( + ErrorCodeEnum.EMAIL_ALREADY_EXISTS.ordinal(), + MessageSourceUtil.getMessage(ErrorCodeEnum.EMAIL_ALREADY_EXISTS, TestConstant.EMAIL) + ) + )); + } + + @Test + public void testCheckEmailValidityValid() throws Exception { + mvc.perform( + get(ApiPathConstant.USER_CHECK_EMAIL_VALIDITY_API_PATH) + .param("email", new Date().getTime() + "@cmipt.edu")) + .andExpectAll(status().isOk()); + } + + @Test + public void testCheckUsernameValidityExists() throws Exception { + mvc.perform( + get(ApiPathConstant.USER_CHECK_USERNAME_VALIDITY_API_PATH) + .param("username", TestConstant.USERNAME)) + .andExpectAll(status().isBadRequest(), content().json( + """ + { + "code": %d, + "message": "%s" + } + """.formatted( + ErrorCodeEnum.USERNAME_ALREADY_EXISTS.ordinal(), + MessageSourceUtil.getMessage(ErrorCodeEnum.USERNAME_ALREADY_EXISTS, TestConstant.USERNAME) + ) + )); + } + + @Test + public void testCheckUsernameValidityValid() throws Exception { + mvc.perform( + get(ApiPathConstant.USER_CHECK_USERNAME_VALIDITY_API_PATH) + .param("username", new Date().getTime() + "")) + .andExpectAll(status().isOk()); + } } From 89031c6416ce837382de01385b9e85a509ecf7b8 Mon Sep 17 00:00:00 2001 From: Kaiser-Yang Date: Fri, 13 Sep 2024 09:32:16 +0000 Subject: [PATCH 2/2] Apply Google Java Style Format --- .../cmipt/gcs/constant/ApiPathConstant.java | 3 +- .../cmipt/gcs/controller/UserController.java | 26 ++++---- .../gcs/exception/GlobalExceptionHandler.java | 10 +-- .../gcs/controller/UserControllerTest.java | 63 +++++++++++-------- 4 files changed, 58 insertions(+), 44 deletions(-) diff --git a/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java b/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java index 750b89d..b804b98 100644 --- a/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java +++ b/src/main/java/edu/cmipt/gcs/constant/ApiPathConstant.java @@ -22,5 +22,6 @@ public class ApiPathConstant { public static final String USER_GET_USER_BY_NAME_API_PATH = USER_API_PREFIX + "/{username}"; public static final String USER_CHECK_EMAIL_VALIDITY_API_PATH = USER_API_PREFIX + "/email"; - public static final String USER_CHECK_USERNAME_VALIDITY_API_PATH = USER_API_PREFIX + "/username"; + public static final String USER_CHECK_USERNAME_VALIDITY_API_PATH = + USER_API_PREFIX + "/username"; } diff --git a/src/main/java/edu/cmipt/gcs/controller/UserController.java b/src/main/java/edu/cmipt/gcs/controller/UserController.java index 4653c42..d6f5272 100644 --- a/src/main/java/edu/cmipt/gcs/controller/UserController.java +++ b/src/main/java/edu/cmipt/gcs/controller/UserController.java @@ -21,6 +21,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; + import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; @@ -93,10 +94,11 @@ public UserVO getUserByName(@PathVariable("username") String username) { description = "Email is invalid", content = @Content(schema = @Schema(implementation = ErrorVO.class))) }) - public void checkEmailValidity(@RequestParam("email") - @Email(message = "USERDTO_EMAIL_EMAIL {UserDTO.email.Email}") - @NotBlank(message = "USERDTO_EMAIL_NOTBLANK {UserDTO.email.NotBlank}") - String email) { + public void checkEmailValidity( + @RequestParam("email") + @Email(message = "USERDTO_EMAIL_EMAIL {UserDTO.email.Email}") + @NotBlank(message = "USERDTO_EMAIL_NOTBLANK {UserDTO.email.NotBlank}") + String email) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("email", email); if (userService.exists(wrapper)) { @@ -123,14 +125,14 @@ public void checkEmailValidity(@RequestParam("email") description = "Username is not valid", content = @Content(schema = @Schema(implementation = ErrorVO.class))) }) - public void checkUsernameValidity(@RequestParam("username") - @Size( - min = ValidationConstant.MIN_USERNAME_LENGTH, - max = ValidationConstant.MAX_USERNAME_LENGTH, - message = "USERDTO_USERNAME_SIZE {UserDTO.username.Size}") - @NotBlank( - message = "USERDTO_USERNAME_NOTBLANK {UserDTO.username.NotBlank}") - String username) { + public void checkUsernameValidity( + @RequestParam("username") + @Size( + min = ValidationConstant.MIN_USERNAME_LENGTH, + max = ValidationConstant.MAX_USERNAME_LENGTH, + message = "USERDTO_USERNAME_SIZE {UserDTO.username.Size}") + @NotBlank(message = "USERDTO_USERNAME_NOTBLANK {UserDTO.username.NotBlank}") + String username) { QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("username", username); if (userService.exists(wrapper)) { diff --git a/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java b/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java index 7fb17ec..97fc660 100644 --- a/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java +++ b/src/main/java/edu/cmipt/gcs/exception/GlobalExceptionHandler.java @@ -42,9 +42,7 @@ public ResponseEntity handleMethodArgumentNotValidException( /** * Handles ConstraintViolationException * - *

- * This method is used to handle the ConstraintViolationException, which is - * thrown when the + *

This method is used to handle the ConstraintViolationException, which is thrown when the * validation of the path variables or request parameters fails. * * @param e ConstraintViolationException @@ -52,7 +50,8 @@ public ResponseEntity handleMethodArgumentNotValidException( @ExceptionHandler(ConstraintViolationException.class) public ResponseEntity handleConstraintViolationException( ConstraintViolationException e, HttpServletRequest request) { - return handleValidationException(e.getConstraintViolations().iterator().next().getMessage(), request); + return handleValidationException( + e.getConstraintViolations().iterator().next().getMessage(), request); } @ExceptionHandler(HttpMessageNotReadableException.class) @@ -88,7 +87,8 @@ public void handleException(Exception e) { logger.error(e.getMessage()); } - private ResponseEntity handleValidationException(String codeAndMessage, HttpServletRequest request) { + private ResponseEntity handleValidationException( + String codeAndMessage, HttpServletRequest request) { int firstSpaceIndex = codeAndMessage.indexOf(" "); // There must be a space and not at the end of the message assert firstSpaceIndex != -1; diff --git a/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java b/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java index 5d111f7..b64bd4f 100644 --- a/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java +++ b/src/test/java/edu/cmipt/gcs/controller/UserControllerTest.java @@ -6,8 +6,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import java.util.Date; - import edu.cmipt.gcs.constant.ApiPathConstant; import edu.cmipt.gcs.constant.HeaderParameter; import edu.cmipt.gcs.constant.TestConstant; @@ -20,6 +18,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.servlet.MockMvc; +import java.util.Date; + /** * Tests for UserController * @@ -70,17 +70,22 @@ public void testCheckEmailValidityExists() throws Exception { mvc.perform( get(ApiPathConstant.USER_CHECK_EMAIL_VALIDITY_API_PATH) .param("email", TestConstant.EMAIL)) - .andExpectAll(status().isBadRequest(), content().json( - """ - { - "code": %d, - "message": "%s" - } - """.formatted( - ErrorCodeEnum.EMAIL_ALREADY_EXISTS.ordinal(), - MessageSourceUtil.getMessage(ErrorCodeEnum.EMAIL_ALREADY_EXISTS, TestConstant.EMAIL) - ) - )); + .andExpectAll( + status().isBadRequest(), + content() + .json( + """ + { + "code": %d, + "message": "%s" + } + """ + .formatted( + ErrorCodeEnum.EMAIL_ALREADY_EXISTS + .ordinal(), + MessageSourceUtil.getMessage( + ErrorCodeEnum.EMAIL_ALREADY_EXISTS, + TestConstant.EMAIL)))); } @Test @@ -88,7 +93,7 @@ public void testCheckEmailValidityValid() throws Exception { mvc.perform( get(ApiPathConstant.USER_CHECK_EMAIL_VALIDITY_API_PATH) .param("email", new Date().getTime() + "@cmipt.edu")) - .andExpectAll(status().isOk()); + .andExpectAll(status().isOk()); } @Test @@ -96,17 +101,23 @@ public void testCheckUsernameValidityExists() throws Exception { mvc.perform( get(ApiPathConstant.USER_CHECK_USERNAME_VALIDITY_API_PATH) .param("username", TestConstant.USERNAME)) - .andExpectAll(status().isBadRequest(), content().json( - """ - { - "code": %d, - "message": "%s" - } - """.formatted( - ErrorCodeEnum.USERNAME_ALREADY_EXISTS.ordinal(), - MessageSourceUtil.getMessage(ErrorCodeEnum.USERNAME_ALREADY_EXISTS, TestConstant.USERNAME) - ) - )); + .andExpectAll( + status().isBadRequest(), + content() + .json( + """ + { + "code": %d, + "message": "%s" + } + """ + .formatted( + ErrorCodeEnum.USERNAME_ALREADY_EXISTS + .ordinal(), + MessageSourceUtil.getMessage( + ErrorCodeEnum + .USERNAME_ALREADY_EXISTS, + TestConstant.USERNAME)))); } @Test @@ -114,6 +125,6 @@ public void testCheckUsernameValidityValid() throws Exception { mvc.perform( get(ApiPathConstant.USER_CHECK_USERNAME_VALIDITY_API_PATH) .param("username", new Date().getTime() + "")) - .andExpectAll(status().isOk()); + .andExpectAll(status().isOk()); } }