@Test public void scheduleCreateOperation() { cache.scheduleCreateOperation(); assertThat( cache.getCrudOperationToBePerformed(), is(new CreateOperation<>(repository, serviceFundingSource))); }
@Test public void whenCretingANewServiceFundingSourceTheCacheShouldUpdateItsLocalCachedServiceFundingSourceWithTheNewOne() { PaymentFundingSource paymentFundingSource = mock(PaymentFundingSource.class); final ServiceFundingSource expected = mock(ServiceFundingSource.class); when(paymentFundingSource.createNewServiceFundingSource()).thenReturn(expected); ServiceFundingSource result = cache.createNewServiceFundingSource(paymentFundingSource); assertThat(cache.getServiceFundingSource(), is(expected)); assertThat(cache.getServiceFundingSource(), is(result)); assertThat(result, is(not(nullValue()))); }
@Test public void whenTheCacheObservesANonEmtyBudgetClassificationItShouldUpdateItsCachedServiceFundingSourceWithObservedBudgetClassification() { BudgetClassification budgetClassification = Mockito.mock(BudgetClassification.class); cache.updateServiceFundingSourceWithBudgetClassification(budgetClassification); verify(serviceFundingSource).setFundingSource(budgetClassification); }