@@ -0,0 +1,2429 @@
+package org.simpleframework.xml.core;%0D%0A%0D%0Aimport java.lang.reflect.Constructor;%0D%0Aimport java.lang.reflect.Field;%0D%0A%0D%0Aimport junit.framework.TestCase;%0D%0A%0D%0Aimport org.simpleframework.xml.Default;%0D%0Aimport org.simpleframework.xml.Element;%0D%0Aimport org.simpleframework.xml.Root;%0D%0Aimport org.simpleframework.xml.stream.NodeBuilder;%0D%0A%0D%0Apublic class MissingPrefixTest extends TestCase %7B%0D%0A   %0D%0A   private static final String BLAH =       %0D%0A   %22%3Cblah%3E%5Cn%22+%0D%0A   %22   %3Cd:foo%3E%5Cn%22+%0D%0A   %22      %3Cx%3Ex%3C/x%3E%5Cn%22+%0D%0A   %22      %3Cy%3E1%3C/y%3E%5Cn%22+%0D%0A   %22      %3Cz%3E2%3C/z%3E%5Cn%22+%0D%0A   %22   %3C/d:foo%3E%5Cn%22+%0D%0A   %22%3C/blah%3E%5Cn%22;%0D%0A%0D%0A%0D%0A   @Root%0D%0A   public static class Blah  %7B%0D%0A      @Element%0D%0A      private BlahBlah foo;%0D%0A      public Blah() %7B%0D%0A         super();%0D%0A      %7D%0D%0A      public Blah(String x, int y, long z) %7B%0D%0A         this.foo = new BlahBlah(x, y, z);%0D%0A      %7D%0D%0A       %0D%0A   %7D%0D%0A   %0D%0A   @Default%0D%0A   public static class BlahBlah %7B%0D%0A      private String x;%0D%0A      private int y;%0D%0A      private long z;%0D%0A      public BlahBlah(%0D%0A            @Element(name=%22x%22)String x, %0D%0A            @Element(name=%22y%22)int y, %0D%0A            @Element(name=%22z%22)long z) %7B%0D%0A         this.x = x;%0D%0A         this.y = y;%0D%0A         this.z = z;%0D%0A         %0D%0A      %7D%0D%0A   %7D%0D%0A   %0D%0A   public void setUp() throws Exception %7B%0D%0A      changeToPullProvider();%0D%0A   %7D%0D%0A   %0D%0A   public void testMissingPrefix() throws Exception %7B%0D%0A      boolean failure = false;%0D%0A      try %7B%0D%0A         Persister p = new Persister();%0D%0A         Blah b = new Blah(%22x%22, 1, 2);%0D%0A         Blah a = p.read(Blah.class, BLAH);%0D%0A         %0D%0A         assertEquals(a.foo.x, %22x%22);%0D%0A         assertEquals(a.foo.y, 1);%0D%0A         assertEquals(a.foo.z, 2);%0D%0A         %0D%0A         p.write(b, System.out); %0D%0A      %7Dcatch(Exception e) %7B%0D%0A         e.printStackTrace();%0D%0A         failure = true;%0D%0A      %7D%0D%0A      assertTrue(%22Failure should have occured for unresolved prefix%22, failure);%0D%0A   %7D%0D%0A   %0D%0A   private void changeToPullProvider() throws Exception %7B%0D%0A      try %7B      %0D%0A         Class c = Class.forName(%22org.simpleframework.xml.stream.PullProvider%22);%0D%0A         Constructor%5B%5D cons = c.getDeclaredConstructors();%0D%0A         for(Constructor con : cons) %7B%0D%0A            con.setAccessible(true);%0D%0A         %7D%0D%0A         Object o = cons%5B0%5D.newInstance();%0D%0A         Field f = NodeBuilder.class.getDeclaredField(%22provider%22);%0D%0A         f.setAccessible(true);%0D%0A         f.set(null, o);%0D%0A      %7Dcatch(Exception e) %7B%0D%0A         e.printStackTrace();%0D%0A      %7D%0D%0A   %7D%0D%0A   %0D%0A   %0D%0A%7D%0D%0A

Check missing prefixes are tested