В API, над которым я работаю, у меня есть следующее определение:
@PUT
@Path("/{messageTypeId}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Amend the Message Type.", notes = "Amend the Message Type.", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful response.", response = Void.class),
@ApiResponse(code = 400, message = "Bad Request.", response = Problem.class),
@ApiResponse(code = 404, message = "Not Found.", response = Problem.class),
@ApiResponse(code = 500, message = "Internal Server Error.", response = Problem.class),
@ApiResponse(code = 503, message = "Service Unavailable.", response = Problem.class) })
void amendMessageType_(@PathParam("messageTypeId") @Size(max=255) @ApiParam("Message Type Unique Identifier") String messageTypeId,@Valid MessageTypeAmendBody messageTypeBody) throws Exception;
Существует ExceptionMapper, когда возникает исключение ValidationException, чтобы отловить и отформатировать в JSON ошибку. Похоже, что маппер иногда получает такое сообщение:
arg0 is not correct, must be between 0 and 255
а иногда
messageTypeId is not correct, must be between 0 and 255
Это тот случай, когда я запускаю модульный тест из IntelliJ (я получаю первый) и из Maven (второй) или когда я запускаю приложение (одно или другое) ... У вас есть идеи?
Спасибо!