package org.simpleframework.xml.convert;

import java.io.StringWriter;

import junit.framework.TestCase;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Default;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import org.simpleframework.xml.strategy.Strategy;
import org.simpleframework.xml.stream.InputNode;
import org.simpleframework.xml.stream.OutputNode;

public class HideEnclosingConverterTest extends TestCase {

   private static class EntryConverter implements Converter<Entry> {
      private final Serializer serializer;
      public EntryConverter() {
         this.serializer = new Persister();
      }
      public Entry read(InputNode node) throws Exception {
         return serializer.read(Entry.class, node);
      }
      public void write(OutputNode node, Entry entry) throws Exception {
         if(!node.isCommitted()) {
            node.remove();
         }
         serializer.write(entry, node.getParent());
      }
   }
   
   @Default(required=false)
   private static class Entry {
      private String name;
      private String value;
      public Entry(@Element(name="name", required=false) String name, @Element(name="value", required=false) String value){
         this.name = name;
         this.value = value;
      }
   }
   
   @Default
   private static class EntryHolder {
      @Convert(EntryConverter.class)
      private Entry entry;
      private String name;
      @Attribute
      private int code;
      public EntryHolder(){
         super();
      }
      public EntryHolder(Entry entry, String name, int code) {
         this.entry = entry;
         this.name = name;
         this.code = code;
      }
   }

   public void testWrapper() throws Exception{
      Strategy strategy = new AnnotationStrategy();
      Serializer serializer = new Persister(strategy);
      Entry entry = new Entry("name", "value");
      EntryHolder holder = new EntryHolder(entry, "test", 10);
      StringWriter writer = new StringWriter();
      serializer.write(holder, writer);
      System.out.println(writer.toString());
      serializer.read(EntryHolder.class, writer.toString());
      System.err.println(writer.toString());
   }
}

@@ -538,30 +538,29 @@
 se %7B%0D%0A%0D%0A   p
-rivate
+ublic
  static clas
@@ -1112,30 +1112,29 @@
 false)%0D%0A   p
-rivate
+ublic
  static clas
@@ -1150,32 +1150,38 @@
 %0D%0A      private 
+final 
 String name;%0D%0A  
@@ -1188,24 +1188,30 @@
     private 
+final 
 String value
@@ -1397,32 +1397,162 @@
 alue;%0D%0A      %7D%0D%0A
+      public String getName()%7B%0D%0A         return name;%0D%0A      %7D%0D%0A      public String getValue()%7B%0D%0A         return value;%0D%0A      %7D%0D%0A
    %7D%0D%0A   %0D%0A   @D
@@ -1563,22 +1563,21 @@
 lt%0D%0A   p
-rivate
+ublic
  static 
@@ -1763,182 +1763,386 @@
 der(
-)%7B%0D%0A         super();%0D%0A      %7D%0D%0A      public EntryHolder(Entry entry, String name, int code) %7B%0D%0A         this.entry = entry;%0D%0A         this.name = name;%0D%0A         this.code =
+@Element(name=%22entry%22) Entry entry, @Element(name=%22name%22) String name, @Attribute(name=%22code%22) int code) %7B%0D%0A         this.entry = entry;%0D%0A         this.name = name;%0D%0A         this.code = code;%0D%0A      %7D%0D%0A      public Entry getEntry()%7B%0D%0A         return entry;%0D%0A      %7D%0D%0A      public String getName() %7B%0D%0A         return name;%0D%0A      %7D%0D%0A      public int getCode() %7B%0D%0A         return
  cod

Make the test a little clearer