Code example for Scanner

Methods: close, useDelimiter

0
	 
	@Before 
	public void setUp() throws Exception { 
		basePath = new java.io.File("src/test/resources/").getCanonicalPath();
		xslFile = basePath + "/Test.xsl";		
		Scanner scanner = new Scanner(new File(basePath + "/Invoice.xml"));
		xmlFile = scanner.useDelimiter("\\Z").next();
		scanner.close();
	} 
 
	@Test 
	public void testMain() throws Exception { 
		Utils utils = new Utils();
		Document xmlDoc = utils.stringToXMLDOM(xmlFile);
		 
		no.difi.vefa.xml.XmlXslTransformation xmlXslTransformation = new no.difi.vefa.xml.XmlXslTransformation();
		Document result = xmlXslTransformation.main(xmlDoc, xslFile);
 
		assertEquals("true", result.getElementsByTagName("status").item(0).getTextContent());
	} 
}