/** @tests javax.xml.parsers.DocumentBuilderFactory#setExpandEntityReferences(boolean). */
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      notes = "",
      method = "setExpandEntityReferences",
      args = {boolean.class})
  public void test_setExpandEntityReferencesZ() {
    dbf.setExpandEntityReferences(true);
    assertTrue(dbf.isExpandEntityReferences());

    Exception parseException = null;
    DocumentBuilder parser = null;

    try {
      parser = dbf.newDocumentBuilder();
      ValidationErrorHandler errorHandler = new ValidationErrorHandler();
      parser.setErrorHandler(errorHandler);

      Document document = parser.parse(getClass().getResourceAsStream("/recipt.xml"));

      parseException = errorHandler.getFirstException();

      assertNotNull(document);

    } catch (Exception ex) {
      parseException = ex;
    }
    parser.setErrorHandler(null);

    if (parseException != null) {
      fail("Unexpected exception " + parseException.getMessage());
    }

    dbf.setExpandEntityReferences(false);
    assertFalse(dbf.isExpandEntityReferences());
    try {
      parser = dbf.newDocumentBuilder();
      ValidationErrorHandler errorHandler = new ValidationErrorHandler();
      parser.setErrorHandler(errorHandler);

      Document document = parser.parse(getClass().getResourceAsStream("/recipt.xml"));

      parseException = errorHandler.getFirstException();

      assertNotNull(document);

    } catch (Exception ex) {
      parseException = ex;
    }
    parser.setErrorHandler(null);

    if (parseException != null) {
      fail("Unexpected exception " + parseException.getMessage());
    }
  }
  /** @tests javax.xml.parsers.DocumentBuilderFactory#setCoalescing(boolean). */
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      notes = "",
      method = "setCoalescing",
      args = {boolean.class})
  public void test_setCoalescingZ() {
    dbf.setCoalescing(true);
    assertTrue(dbf.isCoalescing());

    textElements.clear();
    cdataElements.clear();
    Exception parseException = null;
    DocumentBuilder parser = null;

    try {
      parser = dbf.newDocumentBuilder();
      ValidationErrorHandler errorHandler = new ValidationErrorHandler();
      parser.setErrorHandler(errorHandler);

      Document document = parser.parse(getClass().getResourceAsStream("/recipt.xml"));

      parseException = errorHandler.getFirstException();

      goThroughDocument((Node) document, "");
      assertTrue(textElements.contains("BeefParmesan<title>withGarlicAngelHairPasta</title>"));
    } catch (Exception ex) {
      parseException = ex;
    }
    parser.setErrorHandler(null);

    if (parseException != null) {
      fail("Unexpected exception " + parseException.getMessage());
    }

    dbf.setCoalescing(false);
    assertFalse(dbf.isCoalescing());

    textElements.clear();
    cdataElements.clear();

    try {
      parser = dbf.newDocumentBuilder();
      ValidationErrorHandler errorHandler = new ValidationErrorHandler();
      parser.setErrorHandler(errorHandler);

      Document document = parser.parse(getClass().getResourceAsStream("/recipt.xml"));

      parseException = errorHandler.getFirstException();

      goThroughDocument((Node) document, "");

      assertFalse(textElements.contains("BeefParmesan<title>withGarlicAngelHairPasta</title>"));

    } catch (Exception ex) {
      parseException = ex;
    }
    parser.setErrorHandler(null);

    if (parseException != null) {
      fail("Unexpected exception " + parseException.getMessage());
    }
  }