*/
public class JAXBSerializerTestCase extends junit.framework.TestCase
{
public void testSerializer() throws Exception
{
JAXBSerializer serializer = new JAXBSerializer();
SerializationContext context = new SerializationContextJAXWS();
context.setProperty(SerializationContextJAXWS.JAXB_CONTEXT_TYPES, new Class[]{GetCars.class});
context.setJavaType(GetCars.class);
QName qname = new QName("http://jbossws.jboss.org", "GetSedansResponse");
GetCars response = new GetCars();
List<Car> cars = new ArrayList<Car>();
Toyota camry = new Toyota();
camry.setMake("Toyota");
camry.setModel("Camry");
camry.setColor("Black");
cars.add(camry);
Ford focus = new Ford();
focus.setMake("Ford");
focus.setModel("Focus");
focus.setColor("White");
cars.add(focus);
response.setReturn(cars);
SOAPMessageContextJAXWS messageContext = new SOAPMessageContextJAXWS();
QName portTypeName = new QName("http://jbossws.jboss.org", "GetSedans");
EndpointMetaData endpointMetaData = new MockEndpointMetaData(portTypeName);
messageContext.setEndpointMetaData(endpointMetaData);
MessageContextAssociation.pushMessageContext(messageContext);
BufferedStreamResult result = (BufferedStreamResult)serializer.serialize(qname, null, response, context, null);
Element element = DOMUtils.parse(result.toString());
List<Element> elements = DOMUtils.getChildElementsAsList(element, "return");
for (Element ele : elements)
{
String typeValue = DOMUtils.getAttributeValue(ele, new QName("http://www.w3.org/2001/XMLSchema-instance", "type"));