Added @Override

This commit is contained in:
Arjen Poutsma
2009-01-06 11:19:19 +00:00
parent 03582973d7
commit 6ba9ad8116
18 changed files with 172 additions and 86 deletions

View File

@@ -25,7 +25,8 @@ import org.xml.sax.ContentHandler;
public class CastorMarshallerTest extends AbstractMarshallerTestCase {
protected Marshaller createMarshaller() throws Exception {
@Override
protected Marshaller createMarshaller() throws Exception {
CastorMarshaller marshaller = new CastorMarshaller();
ClassPathResource mappingLocation = new ClassPathResource("mapping.xml", CastorMarshaller.class);
marshaller.setMappingLocation(mappingLocation);
@@ -33,7 +34,8 @@ public class CastorMarshallerTest extends AbstractMarshallerTestCase {
return marshaller;
}
protected Object createFlights() {
@Override
protected Object createFlights() {
Flight flight = new Flight();
flight.setNumber(42L);
Flights flights = new Flights();

View File

@@ -25,20 +25,23 @@ import org.springframework.oxm.Unmarshaller;
public class CastorUnmarshallerTest extends AbstractUnmarshallerTestCase {
protected void testFlights(Object o) {
@Override
protected void testFlights(Object o) {
Flights flights = (Flights) o;
assertNotNull("Flights is null", flights);
assertEquals("Invalid amount of flight elements", 1, flights.getFlightCount());
testFlight(flights.getFlight()[0]);
}
protected void testFlight(Object o) {
@Override
protected void testFlight(Object o) {
Flight flight = (Flight) o;
assertNotNull("Flight is null", flight);
assertEquals("Number is invalid", 42L, flight.getNumber());
}
protected Unmarshaller createUnmarshaller() throws Exception {
@Override
protected Unmarshaller createUnmarshaller() throws Exception {
CastorMarshaller marshaller = new CastorMarshaller();
ClassPathResource mappingLocation = new ClassPathResource("mapping.xml", CastorMarshaller.class);
marshaller.setMappingLocation(mappingLocation);

View File

@@ -29,14 +29,16 @@ public class Jaxb1MarshallerTest extends AbstractJaxbMarshallerTestCase {
private static final String CONTEXT_PATH = "org.springframework.oxm.jaxb1";
protected final Marshaller createMarshaller() throws Exception {
@Override
protected final Marshaller createMarshaller() throws Exception {
Jaxb1Marshaller marshaller = new Jaxb1Marshaller();
marshaller.setContextPaths(new String[]{CONTEXT_PATH});
marshaller.afterPropertiesSet();
return marshaller;
}
protected Object createFlights() {
@Override
protected Object createFlights() {
FlightType flight = new FlightTypeImpl();
flight.setNumber(42L);
Flights flights = new FlightsImpl();

View File

@@ -22,7 +22,8 @@ import org.springframework.oxm.jaxb1.Flights;
public class Jaxb1UnmarshallerTest extends AbstractUnmarshallerTestCase {
protected Unmarshaller createUnmarshaller() throws Exception {
@Override
protected Unmarshaller createUnmarshaller() throws Exception {
Jaxb1Marshaller marshaller = new Jaxb1Marshaller();
marshaller.setContextPath("org.springframework.oxm.jaxb1");
marshaller.setValidating(true);
@@ -30,14 +31,16 @@ public class Jaxb1UnmarshallerTest extends AbstractUnmarshallerTestCase {
return marshaller;
}
protected void testFlights(Object o) {
@Override
protected void testFlights(Object o) {
Flights flights = (Flights) o;
assertNotNull("Flights is null", flights);
assertEquals("Invalid amount of flight elements", 1, flights.getFlight().size());
testFlight(flights.getFlight().get(0));
}
protected void testFlight(Object o) {
@Override
protected void testFlight(Object o) {
FlightType flight = (FlightType) o;
assertNotNull("Flight is null", flight);
assertEquals("Number is invalid", 42L, flight.getNumber());

View File

@@ -24,14 +24,16 @@ import org.springframework.xml.transform.StringResult;
public class JibxMarshallerTest extends AbstractMarshallerTestCase {
protected Marshaller createMarshaller() throws Exception {
@Override
protected Marshaller createMarshaller() throws Exception {
JibxMarshaller marshaller = new JibxMarshaller();
marshaller.setTargetClass(Flights.class);
marshaller.afterPropertiesSet();
return marshaller;
}
protected Object createFlights() {
@Override
protected Object createFlights() {
Flights flights = new Flights();
FlightType flight = new FlightType();
flight.setNumber(42L);

View File

@@ -20,27 +20,31 @@ import org.springframework.oxm.Unmarshaller;
public class JibxUnmarshallerTest extends AbstractUnmarshallerTestCase {
protected Unmarshaller createUnmarshaller() throws Exception {
@Override
protected Unmarshaller createUnmarshaller() throws Exception {
JibxMarshaller unmarshaller = new JibxMarshaller();
unmarshaller.setTargetClass(Flights.class);
unmarshaller.afterPropertiesSet();
return unmarshaller;
}
protected void testFlights(Object o) {
@Override
protected void testFlights(Object o) {
Flights flights = (Flights) o;
assertNotNull("Flights is null", flights);
assertEquals("Invalid amount of flight elements", 1, flights.sizeFlightList());
testFlight(flights.getFlight(0));
}
protected void testFlight(Object o) {
@Override
protected void testFlight(Object o) {
FlightType flight = (FlightType) o;
assertNotNull("Flight is null", flight);
assertEquals("Number is invalid", 42L, flight.getNumber());
}
public void testUnmarshalPartialStaxSourceXmlStreamReader() throws Exception {
@Override
public void testUnmarshalPartialStaxSourceXmlStreamReader() throws Exception {
// JiBX does not support reading XML fragments, hence the override here
}
}

View File

@@ -27,7 +27,8 @@ import org.springframework.samples.flight.FlightsDocument.Flights;
public class XmlBeansMarshallerTest extends AbstractMarshallerTestCase {
protected Marshaller createMarshaller() throws Exception {
@Override
protected Marshaller createMarshaller() throws Exception {
return new XmlBeansMarshaller();
}
@@ -41,7 +42,8 @@ public class XmlBeansMarshallerTest extends AbstractMarshallerTestCase {
}
}
protected Object createFlights() {
@Override
protected Object createFlights() {
FlightsDocument flightsDocument = FlightsDocument.Factory.newInstance();
Flights flights = flightsDocument.addNewFlights();
FlightType flightType = flights.addNewFlight();

View File

@@ -31,11 +31,13 @@ import org.springframework.xml.transform.StringSource;
public class XmlBeansUnmarshallerTest extends AbstractUnmarshallerTestCase {
protected Unmarshaller createUnmarshaller() throws Exception {
@Override
protected Unmarshaller createUnmarshaller() throws Exception {
return new XmlBeansMarshaller();
}
protected void testFlights(Object o) {
@Override
protected void testFlights(Object o) {
FlightsDocument flightsDocument = (FlightsDocument) o;
assertNotNull("FlightsDocument is null", flightsDocument);
Flights flights = flightsDocument.getFlights();
@@ -43,7 +45,8 @@ public class XmlBeansUnmarshallerTest extends AbstractUnmarshallerTestCase {
testFlight(flights.getFlightArray(0));
}
protected void testFlight(Object o) {
@Override
protected void testFlight(Object o) {
FlightType flight = null;
if (o instanceof FlightType) {
flight = (FlightType) o;
@@ -56,7 +59,8 @@ public class XmlBeansUnmarshallerTest extends AbstractUnmarshallerTestCase {
assertEquals("Number is invalid", 42L, flight.getNumber());
}
public void testUnmarshalPartialStaxSourceXmlStreamReader() throws Exception {
@Override
public void testUnmarshalPartialStaxSourceXmlStreamReader() throws Exception {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(INPUT_STRING));
streamReader.nextTag(); // skip to flights