### Question:
AegisElementProvider extends AbstractAegisProvider<T> { public T readFrom(Class<T> type, Type genericType, Annotation[] annotations, MediaType m, MultivaluedMap<String, String> headers, InputStream is) throws IOException { if (genericType == null) { genericType = type; } if (type == null) { type = messyCastToRawType(genericType); } AegisContext context = getAegisContext(type, genericType); AegisType typeToRead = context.getTypeMapping().getType(genericType); AegisReader<XMLStreamReader> aegisReader = context.createXMLStreamReader(); XMLStreamReader xmlStreamReader = null; try { xmlStreamReader = createStreamReader(typeToRead, is); return type.cast(aegisReader.read(xmlStreamReader, typeToRead)); } catch (Exception e) { throw ExceptionUtils.toBadRequestException(e, null); } finally { try { StaxUtils.close(xmlStreamReader); } catch (XMLStreamException e) { throw ExceptionUtils.toBadRequestException(e, null); } } }  T readFrom(Class<T> type, Type genericType, Annotation[] annotations, MediaType m,
        MultivaluedMap<String, String> headers, InputStream is); void writeTo(T obj, Class<?> type, Type genericType, Annotation[] anns,
        MediaType m, MultivaluedMap<String, Object> headers, OutputStream os);  }### Answer:
@Test public void testReadFrom() throws Exception { MessageBodyReader<AegisTestBean> p = new AegisElementProvider<>(); byte[] simpleBytes = simpleBeanXml.getBytes("utf-8"); AegisTestBean bean = p.readFrom(AegisTestBean.class, null, null, null, null, new ByteArrayInputStream(simpleBytes)); assertEquals("hovercraft", bean.getStrValue()); assertTrue(bean.getBoolValue()); }
@Test public void testNoNamespaceReadFrom() throws Exception { MessageBodyReader<AegisTestBean> p = new NoNamespaceAegisElementProvider<>(); byte[] bytes = noNamespaceXml.getBytes("utf-8"); AegisTestBean bean = p.readFrom(AegisTestBean.class, null, null, null, null, new ByteArrayInputStream(bytes)); assertEquals("hovercraft", bean.getStrValue()); assertTrue(bean.getBoolValue()); }