@Test public void testInvalidFieldNameConsistingOfNullString() { String invalidCustomEntityId = "invalidCustomEntity2"; EntityBody invalidCustomEntity = new EntityBody(); invalidCustomEntity.put("ID", invalidCustomEntityId); invalidCustomEntity.put("\\x00", "goodFieldValue"); List<ValidationError> validationErrors = customEntityValidator.validate(invalidCustomEntity); Assert.assertEquals("Should be 1 validation error", 1, validationErrors.size()); ValidationError ve = new ValidationError(ValidationError.ErrorType.INVALID_FIELD_NAME, "\\x00", "\\x00", null); Assert.assertEquals("Mismatched validation error", ve.toString(), validationErrors.get(0).toString()); }
public List<ValidationError> validate(EntityBody entityBody) { List<ValidationError> errorList = new ArrayList<ValidationError>(); if (!entityBody.isEmpty()) { validate(entityBody, errorList); } return errorList; }
CustomEntityValidator { public List<ValidationError> validate(EntityBody entityBody) { List<ValidationError> errorList = new ArrayList<ValidationError>(); if (!entityBody.isEmpty()) { validate(entityBody, errorList); } return errorList; } }
CustomEntityValidator { public List<ValidationError> validate(EntityBody entityBody) { List<ValidationError> errorList = new ArrayList<ValidationError>(); if (!entityBody.isEmpty()) { validate(entityBody, errorList); } return errorList; }  }
CustomEntityValidator { public List<ValidationError> validate(EntityBody entityBody) { List<ValidationError> errorList = new ArrayList<ValidationError>(); if (!entityBody.isEmpty()) { validate(entityBody, errorList); } return errorList; }  List<ValidationError> validate(EntityBody entityBody); }
CustomEntityValidator { public List<ValidationError> validate(EntityBody entityBody) { List<ValidationError> errorList = new ArrayList<ValidationError>(); if (!entityBody.isEmpty()) { validate(entityBody, errorList); } return errorList; }  List<ValidationError> validate(EntityBody entityBody);  }