1 16 17 package org.apache.commons.betwixt.dotbetwixt; 18 19 import junit.framework.Test; 20 import junit.framework.TestSuite; 21 22 import org.apache.commons.betwixt.ElementDescriptor; 23 import org.apache.commons.betwixt.XMLBeanInfo; 24 import org.apache.commons.betwixt.XMLIntrospector; 25 import org.apache.commons.betwixt.xmlunit.XmlTestCase; 26 27 32 public class TestIntrospection extends XmlTestCase { 33 34 36 public static Test suite() { 37 return new TestSuite(TestIntrospection.class); 38 } 39 40 42 public TestIntrospection(String testName) { 43 super(testName); 44 } 45 46 48 public void testClassAttribute() throws Exception { 49 53 XMLIntrospector introspector = new XMLIntrospector(); 54 XMLBeanInfo beanInfo = introspector.introspect(ExampleBean.class); 55 ElementDescriptor[] elementDescriptors = beanInfo.getElementDescriptor().getElementDescriptors(); 56 ElementDescriptor elementsElementDescriptor = null; 57 for ( int i=0, size = elementDescriptors.length; i<size ; i++ ) { 58 if ( "example".equals( elementDescriptors[i].getLocalName() ) ) { 59 elementsElementDescriptor = elementDescriptors[i]; 60 } 61 } 62 63 assertNotNull("Element descriptor for elements not found", elementsElementDescriptor); 64 assertEquals( 65 "Class property not set", 66 ExampleImpl.class, 67 elementsElementDescriptor.getImplementationClass()); 68 } 69 } 70 71 | Popular Tags |