114 * expected to be automaically on. So it is a False-True combination. 115 * The test is to test XMLReader with these conditions. 116 * 117 * @throws Exception If any errors occur. 118 */ 119 public void testWithFalseTrue()throws Exception { 120 String outputFile = USER_DIR + "XRNSTableFT.out"; 121 String goldFile = GOLDEN_DIR + "NSTableFTGF.out"; 122 123 SAXParserFactory spf = SAXParserFactory.newInstance(); 124 //NamespaceAware is false by default, so don't need to set here 125 XMLReader xmlReader = spf.newSAXParser().getXMLReader(); 126 try (FileInputStream fis = new FileInputStream(xmlFile); 127 MyNSContentHandler handler = new MyNSContentHandler(outputFile)) { 128 xmlReader.setContentHandler(handler); 129 xmlReader.parse(new InputSource(fis)); 130 } 131 assertTrue(compareWithGold(goldFile, outputFile)); 132 } 133 } 134 135 | 114 * expected to be automaically on. So it is a False-True combination. 115 * The test is to test XMLReader with these conditions. 116 * 117 * @throws Exception If any errors occur. 118 */ 119 public void testWithFalseTrue()throws Exception { 120 String outputFile = USER_DIR + "XRNSTableFT.out"; 121 String goldFile = GOLDEN_DIR + "NSTableFTGF.out"; 122 123 SAXParserFactory spf = SAXParserFactory.newInstance(); 124 //NamespaceAware is false by default, so don't need to set here 125 XMLReader xmlReader = spf.newSAXParser().getXMLReader(); 126 try (FileInputStream fis = new FileInputStream(xmlFile); 127 MyNSContentHandler handler = new MyNSContentHandler(outputFile)) { 128 xmlReader.setContentHandler(handler); 129 xmlReader.parse(new InputSource(fis)); 130 } 131 assertTrue(compareWithGold(goldFile, outputFile)); 132 } 133 } |