@Test
public void testPrimitiveDataSanitization() throws Exception {

    Root root = new Root(
            "  root1   ",
            new Child("   child1  ", 1, 2),
            new NullableChild("  child2 ")
    );
    Optional<Object> sanitizedOpt = new StdValueSanitizer(type -> true).apply(root);
    assertThat(sanitizedOpt).isPresent();
    Root sanitized = (Root) sanitizedOpt.get();
    assertThat(sanitized.getName()).isEqualTo("root1");
    assertThat(sanitized.getChild().getChildName()).isEqualTo("child1");
    assertThat(sanitized.getChild().getMin()).isEqualTo(1);
    assertThat(sanitized.getChild().getMax()).isEqualTo(2);
    assertThat(sanitized.getNullableChild().getOptionalValue()).isEqualTo("child2");
}