/*
* Test for void generateXCas(CasData)
*/
public void testGenerateXCasCasData() throws Exception {
try {
CasData casData = new CasDataImpl();
FeatureStructure testFS = new FeatureStructureImpl();
testFS.setType("Test");
testFS.setId("foo");
testFS.setIndexed(new int[] { 1 });
testFS.setFeatureValue("myFeature", new PrimitiveValueImpl("myValue"));
testFS.setFeatureValue("value", new PrimitiveValueImpl("this should show up in XML content"));
casData.addFeatureStructure(testFS);
CasDataToXCas generator = new CasDataToXCas();
TestContentHandler testContentHandler = new TestContentHandler("Test");
generator.setContentHandler(testContentHandler);
generator.generateXCas(casData);
Assert.assertTrue(testContentHandler.foundTestElement);
// also try colon and dash conversions
casData = new CasDataImpl();
testFS = new FeatureStructureImpl();
testFS.setType("Test_colon_Foo_dash_Bar_colon_What_dash_a_dash_mess");
testFS.setId("foo");
testFS.setIndexed(new int[] { 1 });
testFS.setFeatureValue("myFeature", new PrimitiveValueImpl("myValue"));
testFS.setFeatureValue("value", new PrimitiveValueImpl("this should show up in XML content"));
casData.addFeatureStructure(testFS);
testContentHandler = new TestContentHandler("Test:Foo-Bar:What-a-mess");
generator.setContentHandler(testContentHandler);
generator.generateXCas(casData);
Assert.assertTrue(testContentHandler.foundTestElement);