@Test
public void testGetValidationResult() throws Exception {

  Properties properties = new Properties();
  properties.put("p1", "v1");
  Configuration ambariConfig = new Configuration(properties);
  ViewConfig config = ViewConfigTest.getConfig(xml_valid_instance);
  ViewEntity viewEntity = ViewRegistryTest.getViewEntity(config, ambariConfig, getClass().getClassLoader(), "");
  ViewInstanceEntity viewInstanceEntity = ViewRegistryTest.getViewInstanceEntity(viewEntity, config.getInstances().get(0));
  ViewEntityTest.TestValidator validator = new ViewEntityTest.TestValidator();
  validator.result = new ValidationResultImpl(true, "detail");
  viewEntity.setValidator(validator);
  InstanceValidationResultImpl result = viewInstanceEntity.getValidationResult(viewEntity, Validator.ValidationContext.PRE_CREATE);
  Map<String, ValidationResult> propertyResults = result.getPropertyResults();
  junit.framework.Assert.assertEquals(2, propertyResults.size());
  junit.framework.Assert.assertTrue(propertyResults.containsKey("p1"));
  junit.framework.Assert.assertTrue(propertyResults.containsKey("p2"));
  junit.framework.Assert.assertTrue(propertyResults.get("p1").isValid());
  junit.framework.Assert.assertTrue(propertyResults.get("p2").isValid());
}