@@ -0,0 +1,3267 @@
+package org.simpleframework.xml.test;%0A%0Aimport java.io.StringWriter;%0Aimport java.util.Arrays;%0Aimport org.simpleframework.xml.Element;%0Aimport org.simpleframework.xml.ElementArray;%0Aimport org.simpleframework.xml.Root;%0Aimport org.simpleframework.xml.ValidationTestCase;%0Aimport org.simpleframework.xml.convert.AnnotationStrategy;%0Aimport org.simpleframework.xml.convert.Converter;%0Aimport org.simpleframework.xml.convert.Registry;%0Aimport org.simpleframework.xml.convert.RegistryStrategy;%0Aimport org.simpleframework.xml.core.Persister;%0Aimport org.simpleframework.xml.strategy.CycleStrategy;%0Aimport org.simpleframework.xml.strategy.Strategy;%0Aimport org.simpleframework.xml.stream.InputNode;%0Aimport org.simpleframework.xml.stream.OutputNode;%0Aimport org.simpleframework.xml.transform.RegistryMatcher;%0A%0A/**%0A *%0A * @author shevek%0A */%0Apublic class CustomTransformTest extends ValidationTestCase %7B%0A%0A    public static class Property %7B%0A%0A        public String text;%0A%0A        public Property(String text) %7B%0A            this.text = text;%0A        %7D%0A%0A        @Override%0A        public String toString() %7B%0A            return %22P(%22 + text + %22)%22;%0A        %7D%0A%0A    %7D%0A%0A    public static class PropertyConverter implements Converter%3CProperty%3E %7B%0A%0A        @Override%0A        public Property read(InputNode node) throws Exception %7B%0A            System.out.println(%22InputNode is %22 + node);%0A            InputNode anode = node.getAttribute(%22pvalue%22);%0A            System.out.println(%22AttributeNode is %22 + anode);%0A            assertNotNull(%22We got given something which is not a Property node%22, anode);%0A            return new Property(anode.getValue());%0A        %7D%0A%0A        @Override%0A        public void write(OutputNode node, Property value) throws Exception %7B%0A            node.setAttribute(%22pvalue%22, value.text);%0A        %7D%0A    %7D%0A%0A    @Root%0A    public static class Bean %7B%0A%0A        @Element%0A        Object element;%0A        @ElementArray%0A        Object%5B%5D elementArray;%0A%0A        @Override%0A        public String toString() %7B%0A            return %22element=%22 + element + %22, elementArray=%22 + Arrays.toString(elementArray);%0A        %7D%0A    %7D%0A%0A    private void test(Persister persister) throws Exception %7B%0A        Bean bean = new Bean();%0A        bean.element = new Property(%22bar%22);%0A        bean.elementArray = new Property%5B%5D%7Bnew Property(%22baz%22), new Property(%22qux%22)%7D;%0A        StringWriter buffer = new StringWriter();%0A        persister.write(bean, buffer);%0A        System.out.println(%22Buffer is %22 + buffer);%0A%0A        Bean copy = persister.read(Bean.class, buffer.toString());%0A        System.out.println(%22Copy is %22 + copy);%0A    %7D%0A%0A    public void testWithCycleStrategy() throws Exception %7B%0A        Strategy strategy = new CycleStrategy(%22id%22, %22ref%22);%0A        Registry registry = new Registry();%0A        registry.bind(Property.class, new PropertyConverter());%0A        strategy = new RegistryStrategy(registry, strategy);%0A        Persister persister = new Persister(strategy);%0A        test(persister);%0A    %7D%0A%0A    public void testWithRegistryStrategy() throws Exception %7B%0A        Registry registry = new Registry();%0A        registry.bind(Property.class, new PropertyConverter());%0A        Strategy strategy = new RegistryStrategy(registry);%0A        Persister persister = new Persister(strategy);%0A        test(persister);%0A    %7D%0A%7D%0A

Add failing test.