1 package org
.argeo
.slc
.core
.test
.tree
;
3 import org
.springframework
.oxm
.Marshaller
;
4 import org
.springframework
.oxm
.Unmarshaller
;
5 import org
.springframework
.xml
.transform
.StringResult
;
6 import org
.springframework
.xml
.transform
.StringSource
;
8 import org
.apache
.commons
.logging
.Log
;
9 import org
.apache
.commons
.logging
.LogFactory
;
11 import static org
.argeo
.slc
.core
.test
.tree
.TreeTestResultTestUtils
.createCompleteTreeTestResult
;
13 import org
.argeo
.slc
.unit
.AbstractSpringTestCase
;
14 import org
.argeo
.slc
.unit
.test
.tree
.UnitTestTreeUtil
;
16 public class TreeTestResultCastorTest
extends AbstractSpringTestCase
{
17 private Log log
= LogFactory
.getLog(getClass());
19 public void testMarshUnmarsh() throws Exception
{
20 Marshaller marshaller
= getBean("marshaller");
21 Unmarshaller unmarshaller
= getBean("marshaller");
23 TreeTestResult ttr
= createCompleteTreeTestResult();
25 StringResult xml
= new StringResult();
26 marshaller
.marshal(ttr
, xml
);
28 log
.info("Marshalled TreeTestResult: " + xml
);
30 TreeTestResult ttrUnm
= (TreeTestResult
) unmarshaller
31 .unmarshal(new StringSource(xml
.toString()));
33 UnitTestTreeUtil
.assertTreeTestResult(ttr
, ttrUnm
);