### Question:
XSLTJaxbProvider extends JAXBElementProvider<T> { @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] anns, MediaType mt) { if (!super.isWriteable(type, genericType, anns, mt)) { return false; } if (InjectionUtils.isSupportedCollectionOrArray(type)) { return supportJaxbOnly; } if (outClassCanBeHandled(type.getName()) || outClassesToHandle == null && !supportJaxbOnly) { return outTemplatesAvailable(type, anns, mt); } return supportJaxbOnly; }  void setSupportJaxbOnly(boolean support); @Override boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, MediaType mt); @Override boolean isWriteable(Class<?> type, Type genericType, Annotation[] anns, MediaType mt); void setOutTemplate(String loc); void setInTemplate(String loc); void setInMediaTemplates(Map<String, String> map); void setOutMediaTemplates(Map<String, String> map); void setResolver(URIResolver resolver); void setSystemId(String system); void setInParameters(Map<String, Object> inParams); void setOutParameters(Map<String, Object> outParams); void setInProperties(Map<String, String> inProps); void setOutProperties(Map<String, String> outProps); void setInClassNames(List<String> classNames); boolean inClassCanBeHandled(String className); void setOutClassNames(List<String> classNames); boolean outClassCanBeHandled(String className); void setRefreshTemplates(boolean refresh); void setSecureProcessing(boolean secureProcessing);  }### Answer:
@Test public void testIsWriteable() throws Exception { XSLTJaxbProvider<Book> provider = new XSLTJaxbProvider<>(); provider.setOutTemplate(TEMPLATE_LOCATION); provider.isWriteable(Book.class, Book.class, null, MediaType.APPLICATION_XML_TYPE); }
@Test public void testWriteWithAnnotation() throws Exception { XSLTJaxbProvider<Book> provider = new XSLTJaxbProvider<>(); provider.setMessageContext(new MessageContextImpl(createMessage())); Book b = new Book(); b.setId(123L); b.setName("TheBook"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); Annotation[] anns = Root.class.getMethod("getBook").getAnnotations(); assertTrue(provider.isWriteable(Book.class, Book.class, anns, MediaType.TEXT_XML_TYPE)); provider.writeTo(b, Book.class, Book.class, anns, MediaType.TEXT_XML_TYPE, new MetadataMap<String, Object>(), bos); Unmarshaller um = provider.getClassContext(Book.class).createUnmarshaller(); Book b2 = (Book)um.unmarshal(new StringReader(bos.toString())); b.setName("TheBook2"); assertEquals("Transformation is bad", b, b2); }