// XAAL toolkit // Copyright (C) 2009 Ville Karavirta // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . package tests.xaal.parser.modules; import java.io.IOException; import java.io.StringReader; import org.xml.sax.SAXException; import xaal.objects.Defs; import xaal.objects.Xaal; import xaal.parser.ParserModule; import xaal.parser.ParserModuleException; import xaal.parser.XmlParser; import xaal.parser.modules.XaalMainParserModule; import junit.framework.TestCase; public class XaalMainParserModuleTest extends TestCase { private XmlParser xp; public XaalMainParserModuleTest(String name) { super(name); } protected void setUp() throws Exception { super.setUp(); } protected void tearDown() throws Exception { super.tearDown(); } private void initializeXP() throws ParserModuleException { xp = new XmlParser(); xp.registerParserModule(XaalMainParserModule.class.getName()); } private Xaal commonTests() { Object o = ParserModule.getProperty(XaalMainParserModule.XAAL_ROOT_OBJECT); assertEquals("XAAL_ROOT_OBJECT is null", true, o != null); assertEquals("XAAL_ROOT_OBJECT not instance of " + Xaal.class.getName(), true, o instanceof Xaal); return (Xaal) o; } public void testDefs() throws ParserModuleException, IOException, SAXException { initializeXP(); xp.parse(new StringReader("" + ""+ ""+ "")); Xaal x = commonTests(); assertEquals("1.0", x.getVersion()); Defs d = x.getDefs(); assertEquals(false, d == null); } }