Exemplo n.º 1
0
  @Test
  public void testGetFlightsXml()
      throws AirlineException, DatatypeConfigurationException, TransformerException {
    GetFlightsRequest request = JAXB.unmarshal(getStream("request1.xml"), GetFlightsRequest.class);

    GetFlightsResponse response = endpoint.getFlights(request);

    DOMResult domResponse = new DOMResult();
    JAXB.marshal(response, domResponse);

    XMLUnit.setIgnoreWhitespace(true);
    XMLAssert.assertXMLEqual(getDocument("response1.xml"), (Document) domResponse.getNode());
  }
Exemplo n.º 2
0
  @Test
  public void testGetFlights() throws AirlineException, DatatypeConfigurationException {
    GetFlightsRequest request = new GetFlightsRequest();
    request.setFrom("PRG");
    request.setTo("DUB");
    request.setServiceClass(ServiceClass.BUSINESS);
    request.setDepartureDate(
        DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2011, 02, 23, 0));
    // more setter calls could be here

    GetFlightsResponse response = endpoint.getFlights(request);

    List<Flight> flights = response.getFlight();
    assertEquals(1, flights.size());
    assertEquals(ServiceClass.BUSINESS, flights.get(0).getServiceClass());
    // more assertions here

  }