@Test public void doesNotUpdateTheCurrenciesQuoteRepositoryIfResponseIsEmpty() { CurrencyPairQuotationsRepositoryUpdaterAction currenciesQuoteRepositoryUpdaterAction = new CurrencyPairQuotationsRepositoryUpdaterAction(modifiableCurrenciesQuoteRepository); when(feedReadResponse.feedReadResponseUnsuccessful()).thenReturn(false); when(feedReadResponse.getResponse()).thenReturn(""); currenciesQuoteRepositoryUpdaterAction.actOn(feedReadResponse); verifyZeroInteractions(modifiableCurrenciesQuoteRepository); }
@Test public void updatesTheCurrenciesQuoteRepositoryIfResponseIsSuccessfulAndNotEmpty() { CurrencyPairQuotationsRepositoryUpdaterAction currenciesQuoteRepositoryUpdaterAction = new CurrencyPairQuotationsRepositoryUpdaterAction(modifiableCurrenciesQuoteRepository); when(feedReadResponse.feedReadResponseUnsuccessful()).thenReturn(false); when(feedReadResponse.getResponse()).thenReturn(aNonEmptyString()); when(feedReadResponse.currencyPairQuotation()).thenReturn(theCurrencyPairQuotation); currenciesQuoteRepositoryUpdaterAction.actOn(feedReadResponse); verify(modifiableCurrenciesQuoteRepository).save(theCurrencyPairQuotation); }