diff options
Diffstat (limited to 'platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java')
-rw-r--r-- | platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java index 9a3fcb9d7066..8d0576c12405 100644 --- a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java +++ b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java @@ -23,6 +23,7 @@ import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.annotations.*; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.intellij.lang.annotations.Language; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -1133,6 +1134,24 @@ public class XmlSerializerTest extends TestCase { bean); } + public static class BeanWithMapAtTopLevel { + @Property(surroundWithTag = false) + @MapAnnotation(surroundWithTag = false, surroundKeyWithTag = false, surroundValueWithTag = false) + public Map<String, String> map = new HashMap<String, String>(); + + public String option; + } + + public void testMapAtTopLevel() { + BeanWithMapAtTopLevel bean = new BeanWithMapAtTopLevel(); + bean.map.put("a", "b"); + bean.option = "xxx"; + doSerializerTest("<BeanWithMapAtTopLevel>\n" + + " <entry key=\"a\" value=\"b\" />\n" + + " <option name=\"option\" value=\"xxx\" />\n" + + "</BeanWithMapAtTopLevel>", bean); + } + private static class BeanWithConverter { private static class MyConverter extends Converter<Ref<String>> { @Nullable @@ -1193,7 +1212,7 @@ public class XmlSerializerTest extends TestCase { return assertSerializer(bean, expected, "Serialization failure", filter); } - private static Object doSerializerTest(String expectedText, Object bean) { + private static Object doSerializerTest(@Language("XML") String expectedText, Object bean) { try { Element element = assertSerializer(bean, expectedText, null); |