Search in sources :

Example 1 with ParamType

use of org.apache.cxf.jaxrs.fortest.jaxb.jaxbelement.ParamType in project cxf by apache.

the class JAXBElementProviderTest method testReadParamJAXBElement.

@Test
public void testReadParamJAXBElement() throws Exception {
    String xml = "<param xmlns=\"http://jaxbelement/10\">" + "<filter name=\"foo\"/><comment>a</comment></param>";
    JAXBElementProvider<ParamJAXBElement> provider = new JAXBElementProvider<ParamJAXBElement>();
    ParamJAXBElement jaxbElement = provider.readFrom(ParamJAXBElement.class, ParamJAXBElement.class, new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String, String>(), new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
    ParamType param = jaxbElement.getValue();
    assertEquals("a", param.getComment());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ParamJAXBElement(org.apache.cxf.jaxrs.fortest.jaxb.jaxbelement.ParamJAXBElement) ParamType(org.apache.cxf.jaxrs.fortest.jaxb.jaxbelement.ParamType) Test(org.junit.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 ParamJAXBElement (org.apache.cxf.jaxrs.fortest.jaxb.jaxbelement.ParamJAXBElement)1 ParamType (org.apache.cxf.jaxrs.fortest.jaxb.jaxbelement.ParamType)1 Test (org.junit.Test)1