From 19cdd558d3d519e025411022fbe4de94caf977c8 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Tue, 16 Feb 2010 14:25:55 +0000 Subject: [PATCH] Improved Jaxb2Marshaller.supports() --- .../oxm/jaxb/Jaxb2MarshallerTests.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/org.springframework.oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java b/org.springframework.oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java index 54a6a87884..0e9771dbe9 100644 --- a/org.springframework.oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java +++ b/org.springframework.oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java @@ -236,6 +236,19 @@ public class Jaxb2MarshallerTests extends AbstractMarshallerTests { }); } + @Test + public void supportsXmlRootElement() throws Exception { + marshaller = new Jaxb2Marshaller(); + marshaller.setClassesToBeBound(new Class[]{DummyRootElement.class, DummyType.class}); + marshaller.afterPropertiesSet(); + assertTrue("Jaxb2Marshaller does not support XmlRootElement class", marshaller.supports(DummyRootElement.class)); + assertTrue("Jaxb2Marshaller does not support XmlRootElement generic type", marshaller.supports((Type)DummyRootElement.class)); + + assertFalse("Jaxb2Marshaller supports DummyType class", marshaller.supports(DummyType.class)); + assertFalse("Jaxb2Marshaller supports DummyType type", marshaller.supports((Type)DummyType.class)); + } + + @Test public void marshalAttachments() throws Exception { marshaller = new Jaxb2Marshaller();