@Test
public void testWriteJSONAsArray() throws Exception {
org.dom4j.Document dom = readXML(MediaType.APPLICATION_XML_TYPE, "<root><a>1</a></root>");
DOM4JProvider p = new DOM4JProvider();
ProviderFactory factory = ProviderFactory.getInstance();
JSONProvider<Object> provider = new JSONProvider<Object>();
provider.setSerializeAsArray(true);
provider.setDropRootElement(true);
provider.setDropElementsInXmlStream(false);
provider.setIgnoreNamespaces(true);
factory.registerUserProvider(provider);
p.setProviders(new ProvidersImpl(createMessage(factory)));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
p.writeTo(dom, org.dom4j.Document.class, org.dom4j.Document.class,
new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(),