Added "entityResolver", "classDescriptorResolver", "doctypes" and further properties to CastorMarshaller
Also deprecated CastorMarshaller's "object" property in favor of "rootObject". Issue: SPR-8470
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,12 +30,9 @@ import org.springframework.oxm.MarshallingException;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Tests the {@link CastorMarshaller} class.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Jakub Narloch
|
||||
*/
|
||||
@@ -114,7 +111,6 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
|
||||
@Test
|
||||
public void testWhitespacePreserveTrue() throws Exception {
|
||||
|
||||
getCastorUnmarshaller().setWhitespacePreserve(true);
|
||||
Object result = unmarshalFlights();
|
||||
testFlights(result);
|
||||
@@ -122,7 +118,6 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
|
||||
@Test
|
||||
public void testWhitespacePreserveFalse() throws Exception {
|
||||
|
||||
getCastorUnmarshaller().setWhitespacePreserve(false);
|
||||
Object result = unmarshalFlights();
|
||||
testFlights(result);
|
||||
@@ -130,7 +125,6 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
|
||||
@Test
|
||||
public void testIgnoreExtraAttributesTrue() throws Exception {
|
||||
|
||||
getCastorUnmarshaller().setIgnoreExtraAttributes(true);
|
||||
Object result = unmarshal(EXTRA_ATTRIBUTES_STRING);
|
||||
testFlights(result);
|
||||
@@ -146,7 +140,6 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
@Test
|
||||
@Ignore("Not working yet")
|
||||
public void testIgnoreExtraElementsTrue() throws Exception {
|
||||
|
||||
getCastorUnmarshaller().setIgnoreExtraElements(true);
|
||||
getCastorUnmarshaller().setValidating(false);
|
||||
Object result = unmarshal(EXTRA_ELEMENTS_STRING);
|
||||
@@ -161,22 +154,19 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testObject() throws Exception {
|
||||
|
||||
public void testRootObject() throws Exception {
|
||||
Flights flights = new Flights();
|
||||
getCastorUnmarshaller().setObject(flights);
|
||||
getCastorUnmarshaller().setRootObject(flights);
|
||||
Object result = unmarshalFlights();
|
||||
|
||||
testFlights(result);
|
||||
assertSame("Result Flights is different object.", flights, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearCollectionsTrue() throws Exception {
|
||||
|
||||
Flights flights = new Flights();
|
||||
flights.setFlight(new Flight[]{new Flight()});
|
||||
getCastorUnmarshaller().setObject(flights);
|
||||
getCastorUnmarshaller().setRootObject(flights);
|
||||
getCastorUnmarshaller().setClearCollections(true);
|
||||
Object result = unmarshalFlights();
|
||||
|
||||
@@ -188,10 +178,9 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
@Test
|
||||
@Ignore("Fails on the builder server for some reason")
|
||||
public void testClearCollectionsFalse() throws Exception {
|
||||
|
||||
Flights flights = new Flights();
|
||||
flights.setFlight(new Flight[]{new Flight(), null});
|
||||
getCastorUnmarshaller().setObject(flights);
|
||||
getCastorUnmarshaller().setRootObject(flights);
|
||||
getCastorUnmarshaller().setClearCollections(false);
|
||||
Object result = unmarshalFlights();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user