Beispiel #1
0
  public static void main(String[] args) {
    ParserUI.init();

    String msg = null;
    try {
      msg = ParserUtils.readFile("C:\\Mustafa\\workspace\\YellowParser\\expedia.txt");
    } catch (IOException e1) {
      Logger.exception(e1);
    }

    Expedia parser = new Expedia();
    MyBooking mybooking;
    try {
      mybooking = parser.parse(null, msg);
      try {
        Booking finalBooking = mybooking.getBooking();
        mybooking.dump();

        yellowzebra.booking.CreateBooking.postBooking(finalBooking);
      } catch (ApiException e) {
        Logger.err(e.getMessage());
      } catch (BookingException e) {
        Logger.err(e.getMessage());
      }
    } catch (Exception e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
  }
  @Test
  public void testDeletePet() throws Exception {
    Pet pet = createRandomPet();
    api.addPet(pet);

    Pet fetched = api.getPetById(pet.getId());
    api.deletePet(fetched.getId(), null);

    try {
      fetched = api.getPetById(fetched.getId());
      fail("expected an error");
    } catch (ApiException e) {
      assertEquals(404, e.getCode());
    }
  }