ElasticsearchNativeServiceImpl implements ElasticsearchService { @Override public List<Ticker> findTickersByExchange(ExchangeEnum exchange) { return queryElasticsearch(indexForTickers, typeForTickers, Ticker.class, matchQuery("exchange", exchange.toString())); }  @PostConstruct void init(); @Override String indexTick(TickJson tick); @Override String indexTicks(List<TickJson> ticks); @Override String indexIndicator(IndicatorJson indicator); @Override String indexIndicators(List<IndicatorJson> indicators); @Override String indexStrategy(StrategyJson strategy); @Override String indexStrategies(List<StrategyJson> strategies); @Override String findTicks(); @Override List<TickJson> findTicksByRic(String ric); @Override List<IndicatorJson> findIndicatorsByRic(String ric); @Override List<TickJson> findTicksByRicAndDateGreaterThan(String ric, Long date); @Override List<IndicatorJson> findIndicatorsByRicAndDateGreaterThan(String ric, Long date); @Override List<IndicatorJson> findIndicatorsByRicAndNameAndDateGreaterThan(String ric, String name, Long date); @Override List<Ticker> findTickersByExchange(ExchangeEnum exchange); InfrastructureProperties getInfrastructureProperties(); void setInfrastructureProperties(InfrastructureProperties infrastructureProperties);  }
@Test public void testFindTickersByExchange() throws Exception { ExchangeEnum exchangeOne = ExchangeEnum.LSE; ExchangeEnum exchangeTwo = ExchangeEnum.ASX; logger.info("given the following tickers: {} {} {} {}", ricOne, ricTwo, ricFour, ricFive); index(indexForTickers, typeForTickers, T1); index(indexForTickers, typeForTickers, T2); index(indexForTickers, typeForTickers, T4); index(indexForTickers, typeForTickers, T5); refreshElasticsearch(); logger.info("when asking for {}, it should return {}", exchangeOne, Arrays.asList(ricOne, ricTwo)); List<Ticker> resultOne = service.findTickersByExchange(exchangeOne); logger.info(" *** findTickersByExchange({}): {}, expected: {}", exchangeOne, resultOne.stream().map(t -> t.getRicAsString()).collect(toList()), Arrays.asList(ricOne, ricTwo)); assertThat(resultOne).hasSize(2); assertThat(resultOne).containsExactlyInAnyOrder(T1, T2); logger.info("when asking for {}, it should return {}", exchangeTwo, Arrays.asList(ricFour, ricFive)); List<Ticker> resultTwo = service.findTickersByExchange(exchangeTwo); logger.info(" *** findTickersByExchange({}): {}, expected: {}", exchangeTwo, resultTwo.stream().map(t -> t.getRicAsString()).collect(toList()), Arrays.asList(ricFour, ricFive)); assertThat(resultTwo).hasSize(2); assertThat(resultTwo).containsExactlyInAnyOrder(T4, T5); }