Verifying that the plugin attr does not break deserialization.

This commit is contained in:
Jesse Glick committed 2012-09-07 13:38:35 -04:00
1 parent 1ced53e2d1
commit 515c812ff9
1 file changed
+5 -1
@@ -68,6 +68,8 @@ public class RobustReflectionConverterTest extends TestCase {
return o != null ? o.value() : null;
}
});
String prefix1 = RobustReflectionConverterTest.class.getName() + "_-";
String prefix2 = RobustReflectionConverterTest.class.getName() + "$";
Enchufla s1 = new Enchufla();
s1.number = 1;
s1.direction = "North";
@@ -90,7 +92,9 @@ public class RobustReflectionConverterTest extends TestCase {
+ "<Moonwalk plugin='p2'><number>2</number><boot/><lover class='Billy' plugin='p3'/></Moonwalk>"
+ "<Moonwalk plugin='p2'><number>3</number><boot/><jacket/><lover class='Jean' plugin='p4'/></Moonwalk>"
+ "</steppes></Bild></bildz></Projekt>",
xs.toXML(p).replaceAll("\\Q" + RobustReflectionConverterTest.class.getName() + "\\E(_-|[$])", "").replaceAll("\r?\n *", "").replace('"', '\''));
xs.toXML(p).replace(prefix1, "").replace(prefix2, "").replaceAll("\r?\n *", "").replace('"', '\''));
Moonwalk s = (Moonwalk) xs.fromXML("<" + prefix1 + "Moonwalk plugin='p2'><lover class='" + prefix2 + "Billy' plugin='p3'/></" + prefix1 + "Moonwalk>");
assertEquals(Billy.class, s.lover.getClass());
}
@Retention(RetentionPolicy.RUNTIME) @interface Owner {String value();}
public static class Projekt {