@SuppressWarnings("serial") @Test public void testMultipleNestedValidFieldNames() { final String validCustomEntityId = "validCustomEntity2"; EntityBody validCustomEntity = new EntityBody() { { put("ID", validCustomEntityId); put("goodFieldName1", "goodFieldValue"); put("goodFieldName2", new HashMap<String, Object>() { { put("goodSubFieldName1", "goodFieldValue"); put("goodSubFieldName2", "goodFieldValue"); put("goodSubFieldName3", new LinkedList<HashMap<String, Object>>() { { add(new HashMap<String, Object>() { { put("goodSubFieldName1", "goodFieldValue"); } }); add(new HashMap<String, Object>() { { put("goodSubFieldName1", "goodFieldValue"); put("goodSubFieldName2", new HashMap[] { new HashMap<String, Object>() { { put("goodSubFieldName1", "goodFieldValue"); } }, new HashMap<String, Object>() { { put("goodSubFieldName1", "goodFieldValue"); put("goodSubFieldName2", "goodFieldValue"); } } }); } }); } }); } }); } }; List<ValidationError> validationErrors = customEntityValidator.validate(validCustomEntity); Assert.assertTrue("There should be no validation errors", validationErrors.isEmpty()); }
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);  }