/**
* test Script input as a java.lang.String object
*/
public void testStringAsScript()
{
Embedded embedded = new Embedded();
String jellyScript =
"<?xml version=\"1.0\"?>"
+ " <j:jelly xmlns:j=\"jelly:core\">"
+ "jelly-test-case"
+ " </j:jelly>";
embedded.setScript(jellyScript);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
embedded.setOutputStream(baos);
boolean status = embedded.execute();
//executed properly without script errors
assertEquals(status, true);
//check that the output confirms the exepected
assertEquals("jelly-test-case", new String(baos.toByteArray()));
//test generation of error
embedded.setScript(jellyScript + "obnoxious-part");
status = embedded.execute();
//test failure of execution
assertEquals(false, status);
//Asserting the parser generated a errorMsg
assertNotNull(embedded.getErrorMsg());
}