01: /*
02: * Copyright 2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
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
37: .getFlight().size());
38: testFlight(flights.getFlight().get(0));
39: }
40:
41: protected void testFlight(Object o) {
42: FlightType flight = (FlightType) o;
43: assertNotNull("Flight is null", flight);
44: assertEquals("Number is invalid", 42L, flight.getNumber());
45: }
46:
47: }
|