@Test public void shouldFindAirportsByName() { final List<AirportData> airports = airportFacade.find("BRISTOL", null, null, brandList).getAirports(); assertThat(airports, is(notNullValue())); assertThat(airports.size(), is(1)); }
@Test public void shouldSearchForAirportsByAirportCode() { final List<AirportData> airports = airportFacade.find("ALC", null, null, brandList).getAirports(); assertThat(airports, is(notNullValue())); assertThat(airports.size(), is(1)); }
@Test public void shouldIndexAndFindAirportWithParents() { final List<AirportData> airports = airportFacade.find("london gatwick", null, null, brandList).getAirports(); assertThat(airports, hasItem(new AirportData("LGW", "london gatwick"))); final AirportData lgw = filter( airports, new Collections.FilterFn<uk.co.portaltech.tui.web.view.data.AirportData>() { public boolean call(final AirportData input) { return input.getId().equals("LGW"); } }) .get(0); assertThat(lgw.getGroup(), hasItem("LN")); }
@Test public void shouldIndexAndFindAirportWithChildren() { final List<AirportData> airports = airportFacade.find("any london", null, null, brandList).getAirports(); assertThat(airports, hasItem(new AirportData("LN", "Any London"))); final List<AirportData> anyLondons = filter( airports, new Collections.FilterFn<AirportData>() { @Override public boolean call(final AirportData input) { return input.getId().equals("LN"); } }); assertThat(anyLondons, is(notNullValue())); assertThat(anyLondons, hasItem(new AirportData("LN", "AnyLondon"))); final AirportData anyLondon = anyLondons.get(0); assertThat(anyLondon.getChildren(), hasItem("LGW")); }