### Question:
MaxMessageSizeValidator extends ValidatorProcess { public ValidateData process(ProcessValidation processValidation, JsonNode jsonValue) { int eventSize = jsonValue.toString().length(); nbFieldsHistogram.observe(eventSize); if (eventSize > processValidation.getParameterValidation().getMaxMessageSize()) { return createValidateData(false, StatusCode.event_size, TypeValidation.MAX_MESSAGE_SIZE, jsonValue, String.valueOf(eventSize)); } return ValidateData.builder() .success(true) .typeValidation(TypeValidation.MAX_MESSAGE_SIZE) .jsonValue(jsonValue) .build(); } MaxMessageSizeValidator(); ValidateData process(ProcessValidation processValidation, JsonNode jsonValue);  }### Answer:
@Test public void should_Process_Ko() throws Exception { MaxMessageSizeValidator maxMessageSizeValidator = new MaxMessageSizeValidator(); RawDataGen rd = RawDataGen.builder().messageSend("gni").project("project").type("type").build(); ObjectMapper obj = new ObjectMapper(); String value = obj.writeValueAsString(rd); ObjectNode jsonValue = JSONUtils.getInstance().parseObj(value); ValidateData v = maxMessageSizeValidator.process(ProcessValidation.builder() .parameterValidation(ParameterValidation.builder() .maxMessageSize(100L).build() ).build(), jsonValue); assertThat(v.success).isFalse(); }
@Test public void should_Process_Ok() throws Exception { MaxMessageSizeValidator maxMessageSizeValidator = new MaxMessageSizeValidator(); RawDataGen rd = RawDataGen.builder().messageSend("gni").project("project").type("type").build(); ObjectMapper obj = new ObjectMapper(); String value = obj.writeValueAsString(rd); ObjectNode jsonValue = JSONUtils.getInstance().parseObj(value); ValidateData v = maxMessageSizeValidator.process(ProcessValidation.builder() .parameterValidation(ParameterValidation.builder() .maxMessageSize(124L).build() ).build(), jsonValue); assertThat(v.success).isTrue(); }