Mercurial > hg > Members > tatsuki > JungleXMLReader
changeset 6:109d552e4bb6
add functiontest
author | one |
---|---|
date | Sat, 25 Oct 2014 04:53:41 +0900 |
parents | d098ef07214c |
children | 47eb9ee2a1db |
files | src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/Person_idsTest.java |
diffstat | 1 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/jp/ac/u_ryukyu/cr/ie/tatsuki/functionTest/Person_idsTest.java Sat Oct 25 04:53:41 2014 +0900 @@ -0,0 +1,54 @@ +package jp.ac.u_ryukyu.cr.ie.tatsuki.functionTest; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Iterator; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import jp.ac.u_ryukyu.cr.ie.tatsuki.xmlReadTest.TestHandler; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.DefaultJungle; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultTraverser; + +import org.junit.Assert; +import org.junit.Test; +import org.xml.sax.SAXException; + +import ac.jp.u_ryukyu.cr.ie.tatsuki.xmlReader.ReadXmlHandler; + +public class Person_idsTest { + + @Test + public void Person_idsTest(){ + try { + JungleTree newTree = loadTestData(); + + Iterator<String> names = personids(newTree); + + for (;names.hasNext();names.next()) { + Assert.assertArrayEquals(); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public JungleTree loadTestData() throws ParserConfigurationException, + SAXException, IOException, FileNotFoundException { + SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); + SAXParser saxParser = saxParserFactory.newSAXParser(); + Jungle jungle = new DefaultJungle(null, "jungle",new DefaultTreeEditor(new DefaultTraverser())); + JungleTree tree = jungle.createNewTree("maTrixPersons"); + ReadXmlHandler readXmlHandler = new ReadXmlHandler(tree); + saxParser.parse(new FileInputStream("xml/Person.xml"), readXmlHandler); + JungleTree newTree = readXmlHandler.getTree(); + return newTree; + } +}