public void testInvalidXML1Validation() throws Exception { // with validation setUp("invalidScript1.jelly"); jelly.setValidateXML(true); try { Script script = jelly.compileScript(); fail("Invalid scripts should throw JellyException on parse"); } catch (JellyException e) { } }
public void testValidXML1Validation()throws Exception { // with validation setUp("validScript1.jelly"); jelly.setValidateXML(true); Script script = jelly.compileScript(); script.run(context,xmlOutput); assertTrue("should have set 'foo' variable to 'bar'", context.getVariable("foo").equals("bar")); }
public void testParserCache1() throws Exception { // without validation, should // not fail because validation is disabled setUp("invalidScript1.jelly"); jelly.setValidateXML(false); Script script = jelly.compileScript(); script.run(context,xmlOutput); assertTrue("should have set 'foo' variable to 'bar'", context.getVariable("foo").equals("bar")); // if I enable xml validation, the script should fail // despite the cache jelly.setValidateXML(true); try { script = jelly.compileScript(); fail("Invalid scripts should throw JellyException on parse, despite the cache"); } catch (JellyException e) { } }
public void testInvalidXML1NoValidation() throws Exception { // without validation setUp("invalidScript1.jelly"); Script script = jelly.compileScript(); script.run(context,xmlOutput); assertTrue("should have set 'foo' variable to 'bar'", context.getVariable("foo").equals("bar")); // do it again, explicitly setting the validateXML variable setUp("invalidScript1.jelly"); jelly.setValidateXML(false); script = jelly.compileScript(); script.run(context,xmlOutput); assertTrue("should have set 'foo' variable to 'bar'", context.getVariable("foo").equals("bar")); }