Esempio n. 1
0
  @Test
  public void testGetUri() throws Exception {
    StringBuilder queryString = buildBaseQueryString();
    queryString.append("&itineraryId=1234&[email protected]");

    final URI uri = itineraryRequest.getUri();
    assertEquals("http", uri.getScheme());
    assertEquals("api.ean.com", uri.getHost());
    assertEquals("/ean-services/rs/hotel/v3/itin", uri.getPath());
    assertEquals(queryString.toString(), uri.getQuery());
  }
Esempio n. 2
0
  @Test
  public void testConsume() throws Exception {
    Itinerary itinerary =
        itineraryRequest.consume(JSONFileUtil.loadJsonFromFile("valid-itinerary.json"));
    assertNotNull(itinerary);
    assertEquals(107730857L, itinerary.id);
    assertEquals(CommonParameters.cid, String.valueOf(itinerary.affiliateId));
    assertEquals(DateModifier.getDateFromString("01/28/2013"), itinerary.creationDate);
    assertEquals(DateModifier.getDateFromString("02/07/2013"), itinerary.itineraryStartDate);
    assertEquals(DateModifier.getDateFromString("02/10/2013"), itinerary.itineraryEndDate);

    doCustomerAssertions(itinerary.customer);
    doHotelConfirmationAssertions(itinerary.hotelConfirmations);
  }
Esempio n. 3
0
 @Test(expected = EanWsError.class)
 public void testConsumeEanWsError() throws Exception {
   itineraryRequest.consume(JSONFileUtil.loadJsonFromFile("error-itinerary.json"));
 }
Esempio n. 4
0
 @Test(expected = JSONException.class)
 public void testConsumeInvalidJson() throws Exception {
   itineraryRequest.consume(JSONFileUtil.loadJsonFromFile("invalid-itinerary.json"));
 }
Esempio n. 5
0
 @Test(expected = JSONException.class)
 public void testConsumeEmptyJson() throws Exception {
   itineraryRequest.consume(new JSONObject());
 }
Esempio n. 6
0
 @Test
 public void testConsumeNullJson() throws Exception {
   assertNull(itineraryRequest.consume(null));
 }
Esempio n. 7
0
 @Test
 public void testIsSecure() {
   assertThat(itineraryRequest.requiresSecure(), is(false));
 }