### Question:
BooleanTransformator extends TransformatorProcess { public void apply(String idProcess, ParameterTransformation parameterTransformation, ObjectNode jsonValue) { String valueToFormat = at(parameterTransformation.getKeyField(), jsonValue).asText(); if (StringUtils.isNotBlank(valueToFormat)) { put(jsonValue, parameterTransformation.getKeyField(), Boolean.valueOf(valueToFormat.toLowerCase())); } } BooleanTransformator(); void apply(String idProcess, ParameterTransformation parameterTransformation, ObjectNode jsonValue);  }### Answer:
@Test public void should_Process_Ok() throws Exception { BooleanTransformator booleanTransformator = new BooleanTransformator(); RawDataGen rd = RawDataGen.builder().messageSend("true").project("project").type("type").build(); ObjectMapper obj = new ObjectMapper(); String value = obj.writeValueAsString(rd); ObjectNode jsonValue = JSONUtils.getInstance().parseObj(value); booleanTransformator.apply(null, ParameterTransformation.builder() .keyField("messageSend") .build(), jsonValue); assertThat(jsonValue.path("messageSend").asBoolean()).isEqualTo(true); }
@Test public void should_Process_Ko() throws Exception { BooleanTransformator booleanTransformator = new BooleanTransformator(); RawDataGen rd = RawDataGen.builder().messageSend("true").project("project").type("type").build(); ObjectMapper obj = new ObjectMapper(); String value = obj.writeValueAsString(rd); ObjectNode jsonValue = JSONUtils.getInstance().parseObj(value); booleanTransformator.apply(null, ParameterTransformation.builder() .keyField("toto") .build(), jsonValue); assertThat(jsonValue.path("toto").asText()).isEqualTo(""); }
@Test public void should_Process_Upper_Ok() throws Exception { BooleanTransformator booleanTransformator = new BooleanTransformator(); RawDataGen rd = RawDataGen.builder().messageSend("TRUE").project("project").type("type").build(); ObjectMapper obj = new ObjectMapper(); String value = obj.writeValueAsString(rd); ObjectNode jsonValue = JSONUtils.getInstance().parseObj(value); booleanTransformator.apply(null, ParameterTransformation.builder() .keyField("messageSend") .build(), jsonValue); assertThat(jsonValue.path("messageSend").asBoolean()).isEqualTo(true); }