private static void printResults(RefCCDAValidationResult result) {
   System.out.println("Description : " + result.getDescription());
   System.out.println("Type : " + result.getType());
   System.out.println("result.isSchemaError() : " + result.isSchemaError());
   System.out.println("result.isDataTypeSchemaError() : " + result.isDataTypeSchemaError());
   System.out.println();
 }
 private boolean mdhtResultsHaveSchemaError(List<RefCCDAValidationResult> mdhtResults) {
   for (RefCCDAValidationResult result : mdhtResults) {
     if (result.isSchemaError()) {
       return true;
     }
   }
   return false;
 }
  @Test
  public void multipleDocumentsWithAndWithoutSchemaErrorTest() {
    for (int curCCDAFileIndex = 0;
        curCCDAFileIndex < LAST_SCHEMA_TEST_AND_NO_SCHEMA_ERROR_INDEX + 1;
        curCCDAFileIndex++) {
      System.out.println(
          "***************** Running multipleDocumentsWithAndWithoutSchemaErrorTest test #"
              + (curCCDAFileIndex + 1)
              + " ******************"
              + System.lineSeparator());

      ArrayList<RefCCDAValidationResult> results =
          validateDocumentAndReturnResults(convertCCDAFileToString(CCDA_FILES[curCCDAFileIndex]));

      System.out.println(
          System.lineSeparator()
              + "CCDAIssueStates.hasSchemaError(): "
              + mdhtResultsHaveSchemaError(results)
              + System.lineSeparator());
      if (curCCDAFileIndex == 0 || curCCDAFileIndex == LAST_SCHEMA_TEST_AND_NO_SCHEMA_ERROR_INDEX) {
        assertFalse(
            "The document does not have schema error yet the flag is set to true",
            mdhtResultsHaveSchemaError(results));
      } else {
        assertTrue(
            "The document has a schema error yet the flag is set to false",
            mdhtResultsHaveSchemaError(results));
      }

      for (RefCCDAValidationResult result : results) {
        if (SHOW_ERRORS_ONLY) {
          if (result.getType() == ValidationResultType.CCDA_MDHT_CONFORMANCE_ERROR) {
            printResults(result);
          }
        } else {
          printResults(result);
        }
      }

      System.out.println(
          "***************** End results for test #"
              + (curCCDAFileIndex + 1)
              + " ******************"
              + System.lineSeparator()
              + System.lineSeparator());
    }
  }
 @Test
 public void doesNotHaveSchemaErrorTest() {
   ArrayList<RefCCDAValidationResult> results =
       validateDocumentAndReturnResults(
           convertCCDAFileToString(CCDA_FILES[LAST_SCHEMA_TEST_AND_NO_SCHEMA_ERROR_INDEX]));
   // global result
   assertFalse(
       "The document does not have schema error yet the flag is set to true",
       mdhtResultsHaveSchemaError(results));
   // and for sanity, check the single results as well
   boolean schemaErrorInSingleResultFound = false;
   for (RefCCDAValidationResult result : results)
     if (result.isSchemaError()) schemaErrorInSingleResultFound = true;
   assertFalse(
       "The document has no single schema error yet a single result flagged it as true",
       schemaErrorInSingleResultFound);
 }
 @Test
 public void hasSchemaErrorTest() {
   ArrayList<RefCCDAValidationResult> results =
       validateDocumentAndReturnResults(
           convertCCDAFileToString(CCDA_FILES[HAS_SCHEMA_ERROR_INDEX]));
   // global result
   assertTrue(
       "The document has a schema error yet the flag is set to false",
       mdhtResultsHaveSchemaError(results));
   // and for sanity, check the single results as well
   boolean schemaErrorInSingleResultFound = false;
   for (RefCCDAValidationResult result : results)
     if (result.isSchemaError()) schemaErrorInSingleResultFound = true;
   assertTrue(
       "The document has at least one schema error but no single result flagged it as such",
       schemaErrorInSingleResultFound);
 }