### Question:
ExchangeRatesServiceImpl implements ExchangeRatesService { @Override @CatAnnotation public Map<Currency, BigDecimal> getCurrentRates() { if (container == null || !container.getDate().equals(LocalDate.now())) { Transaction dbTransaction = Cat.newTransaction(CatConstants.TYPE_REMOTE_CALL, "get_current_rates"); try { container = client.getRates(Currency.getBase()); log.info("exchange rates has been updated: {}", container); dbTransaction.setStatus(Transaction.SUCCESS); } catch (Exception e) { Cat.getProducer().logError(e); dbTransaction.setStatus(e); throw e; } finally { dbTransaction.complete(); } } return ImmutableMap.of( Currency.EUR, container.getRates().get(Currency.EUR.name()), Currency.RUB, container.getRates().get(Currency.RUB.name()), Currency.USD, BigDecimal.ONE ); }  @Override @CatAnnotation Map<Currency, BigDecimal> getCurrentRates(); @Override @CatAnnotation BigDecimal convert(Currency from, Currency to, BigDecimal amount);  }### Answer:
@Test public void shouldNotRequestRatesWhenTodaysContainerAlreadyExists() { ExchangeRatesContainer container = new ExchangeRatesContainer(); container.setRates(ImmutableMap.of( Currency.EUR.name(), new BigDecimal("0.8"), Currency.RUB.name(), new BigDecimal("80") )); when(client.getRates(Currency.getBase())).thenReturn(container); ratesService.getCurrentRates(); ratesService.getCurrentRates(); verify(client, times(1)).getRates(Currency.getBase()); }
@Test public void shouldReturnCurrentRatesWhenContainerIsEmptySoFar() { ExchangeRatesContainer container = new ExchangeRatesContainer(); container.setRates(ImmutableMap.of( Currency.EUR.name(), new BigDecimal("0.8"), Currency.RUB.name(), new BigDecimal("80") )); when(client.getRates(Currency.getBase())).thenReturn(container); Map<Currency, BigDecimal> result = ratesService.getCurrentRates(); verify(client, times(1)).getRates(Currency.getBase()); assertEquals(container.getRates().get(Currency.EUR.name()), result.get(Currency.EUR)); assertEquals(container.getRates().get(Currency.RUB.name()), result.get(Currency.RUB)); assertEquals(BigDecimal.ONE, result.get(Currency.USD)); }