1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.oxm.jaxb;
17
18 import org.springframework.oxm.AbstractUnmarshallerTestCase;
19 import org.springframework.oxm.Unmarshaller;
20 import org.springframework.oxm.jaxb1.FlightType;
21 import org.springframework.oxm.jaxb1.Flights;
22
23 public class Jaxb1UnmarshallerTest extends AbstractUnmarshallerTestCase {
24
25 protected Unmarshaller createUnmarshaller() throws Exception {
26 Jaxb1Marshaller marshaller = new Jaxb1Marshaller();
27 marshaller.setContextPath("org.springframework.oxm.jaxb1");
28 marshaller.setValidating(true);
29 marshaller.afterPropertiesSet();
30 return marshaller;
31 }
32
33 protected void testFlights(Object o) {
34 Flights flights = (Flights) o;
35 assertNotNull("Flights is null", flights);
36 assertEquals("Invalid amount of flight elements", 1, flights.getFlight().size());
37 testFlight(flights.getFlight().get(0));
38 }
39
40 protected void testFlight(Object o) {
41 FlightType flight = (FlightType) o;
42 assertNotNull("Flight is null", flight);
43 assertEquals("Number is invalid", 42L, flight.getNumber());
44 }
45
46 }