@Test
public void testToJson() throws Exception {

  ValidationResult result = new ValidationResultImpl(true, "detail");
  Map<String, ValidationResult> propertyResults = new LinkedHashMap<>();
  propertyResults.put("foo", new ValidationResultImpl(true, "foo detail"));
  propertyResults.put("bar", new ValidationResultImpl(false, "bar detail"));
  InstanceValidationResultImpl instanceValidationResult = new InstanceValidationResultImpl(result, propertyResults);
  Assert.assertEquals("{\"propertyResults\":{\"foo\":{\"valid\":true,\"detail\":\"foo detail\"},\"bar\":{\"valid\":false,\"detail\":\"bar detail\"}},\"valid\":false,\"detail\":\"The instance has invalid properties.\"}",
      instanceValidationResult.toJson());
}