@Test
public void testPolicyConfigBaseValidation() throws IOException {

    PolicyValidation validation = new PolicyValidation();
    PolicyRestAdapter policyData = new PolicyRestAdapter();
    policyData.setPolicyName("ALegalPolicyName");
    policyData.setPolicyDescription("A Valid Description");
    String responseString = validation.validatePolicy(policyData).toString();
    assertEquals("success", responseString);
    policyData.setApiflag("API");
    responseString = validation.validatePolicy(policyData).toString();
    assertEquals("success", responseString);
    policyData.setPolicyType("Config");
    policyData.setConfigPolicyType("Base");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Onap Name Should not be empty");
    policyData.setOnapName("%%%$$$$");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("<b>OnapName</b>:<i>The Value in Required Field");
    policyData.setOnapName("AValidOnapName");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Risk Level Should not be Empty");
    policyData.setRiskType("%%%$$$$");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("<b>RiskType</b>:<i>The Value in Required Field");
    policyData.setRiskType("AValidRiskType");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Risk Level Should not be Empty");
    policyData.setRiskLevel("%%%$$$$");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("<b>RiskLevel</b>:<i>The Value in Required Field");
    policyData.setRiskLevel("AValidRiskLevel");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Guard Value Should not be Empty");
    policyData.setGuard("%%%$$$$");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("<b>Guard</b>:<i>The Value in Required Field");
    policyData.setGuard("AValidGuard");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Name Should not be Empty");
    policyData.setConfigName("%%%$$$$");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("ConfigName:The Value in Required Field");
    policyData.setConfigName("AValidConfigName");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Type Should not be Empty");
    policyData.setConfigType("%%%$$$$");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("ConfigType:The Value in Required Field");
    policyData.setConfigType("AValidConfigType");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Body Should not be Empty");
    policyData.setConfigBodyData("");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Body Should not be Empty");
    policyData.setConfigBodyData("%%%$$$$");
    responseString = validation.validatePolicy(policyData).toString();
    assertEquals("success@#", responseString);
    policyData.setConfigType(null);
    policyData.setConfigBodyData("ValidConfigBodyData");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Type Should not be Empty");
    policyData.setConfigType("JSON");
    policyData.setConfigBodyData("{");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Body: JSON Content is not valid");
    policyData.setConfigBodyData("ValidConfigBodyData");
    responseString = validation.validatePolicy(policyData).toString();
    assertEquals("success@#", responseString);
    policyData.setConfigType("XML");
    policyData.setConfigBodyData("{");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Body: XML Content data is not valid");
    policyData.setConfigBodyData("<tag>value</tag>");
    responseString = validation.validatePolicy(policyData).toString();
    assertEquals("success@#", responseString);
    policyData.setConfigType("PROPERTIES");
    policyData.setConfigBodyData("{");
    responseString = validation.validatePolicy(policyData).toString();
    assertThat(responseString).contains("Config Body: Property data is not valid");
    policyData.setConfigBodyData("propertyName=PropertyValue");
    responseString = validation.validatePolicy(policyData).toString();
    assertEquals("success@#", responseString);
}