@Sql("/sql/insert_symbols_bre_usd.sql")
@Sql("/sql/insert_rates_bre_usd.sql")
@Test
public void testUpdateRates_WithExistingData() {

	// given
	List<Quote> quotes = getBrentQuotes();
	HistoricalRate expectedOldLatest = new HistoricalRate(BRE, USD, new BigDecimal("55.18"), parse("2015-04-06T02:00:00"));
	HistoricalRate expectedAdded = new HistoricalRate(BRE, USD, new BigDecimal("57.8"), parse("2015-04-08T02:00:00"));
	HistoricalRate expectedNewLatest = new HistoricalRate(BRE, USD, new BigDecimal("58.3"), parse("2015-04-09T02:00:00"));
	LatestRate expectedNewLatest1 = new LatestRate(BRE, USD, new BigDecimal("58.3"), parse("2015-04-09T02:00:00"));
	HistoricalRate olderButAdded = new HistoricalRate(BRE, USD, new BigDecimal("55.18"), parse("2015-04-02T02:00:00"));
	// when
	rateUpdaterService.updateRates(quotes);
	// then
	List<HistoricalRate> hRates = new ArrayList<>(histoRepo.findAll());
	List<LatestRate> lRates = new ArrayList<>(latestRepo.findAll());
	assertThat(hRates).hasSize(7);
	assertThat(hRates).containsOnlyOnce(expectedOldLatest, expectedAdded, expectedNewLatest, olderButAdded);
	assertThat(lRates).hasSize(1);
	assertThat(lRates).containsOnly(expectedNewLatest1);
	verify(activeMQConfig).send(any());
}