import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLReaderAdapter;

/*
 * Copyright (c) 2013 Oracle and/or its affiliates.
 * All rights reserved. Use is subject to license terms.
 */
/**
 * Created: May 31, 2016
 * @author skovalev
 */
public class NewTestCase {
    private final String SAX_PROPNAME = "org.xml.sax.driver";
    private String className;

    {
        try {
            className = SAXParserFactory.newInstance().newSAXParser()
                                .getXMLReader().getClass().getName();
        } catch (Throwable t) {
        }
    }

    public static void main(String arg[]) {
        System.out.print("Test case: Ctor003() --> ");
        System.out.println(new NewTestCase().Ctor003() ? "PASSED" : "FAILED");
    }

    /**
     * Assertion testing
     * for public XMLReaderAdapter() throws SAXException,
     * Creates a new adapter. Uses the "org.xml.sax.driver" property to locate the SAX2 driver.
     * Throws SAXException if the embedded driver cannot be instantiated
     * or if the org.xml.sax.driver property is not specified.
     */
    public boolean Ctor003() {
        try{
            System.setProperty(SAX_PROPNAME, className + "nosuch");
            XMLReaderAdapter adapter=new XMLReaderAdapter();
            System.err.println("Expected SAXException does not occur");
            return false;
        }catch( SAXException saxEx ){
            System.err.println("Embedded driver cannot be instantiated or " +
                                 "the org.xml.sax.driver property is not specified. " + saxEx.getMessage());
            return true;
        }
    }
}
