@Test public void acknowledgeTopUpResultShouldPutAcknowledgedResultIntoCache() { final TopUpAcknowledgeRequest topUpAcknowledgeRequest = new TopUpAcknowledgeRequest(PLAYER_ID, new DateTime()); underTest.acknowledgeTopUpResult(topUpAcknowledgeRequest); assertThat(topUpStatusCache.getStatistics().getMemoryStoreObjectCount(), is(1L)); TopUpResultService.TopUpStatusCacheEntry entry = (TopUpResultService.TopUpStatusCacheEntry) topUpStatusCache.get(PLAYER_ID).getObjectValue(); assertThat(entry.getTopUpStatus(), is(ACKNOWLEDGED)); assertThat(entry.getLastTopUpDate(), is(topUpAcknowledgeRequest.getTopUpDate())); }
@Test public void acknowledgeTopUpResultShouldNotSendAcknowledgeRequestIfAlreadyCached() { final TopUpAcknowledgeRequest topUpAcknowledgeRequest = new TopUpAcknowledgeRequest(PLAYER_ID, new DateTime()); Element element = new Element( PLAYER_ID, new TopUpResultService.TopUpStatusCacheEntry( ACKNOWLEDGED, topUpAcknowledgeRequest.getTopUpDate())); topUpStatusCache.put(element); underTest.acknowledgeTopUpResult(topUpAcknowledgeRequest); assertThat(topUpStatusCache.getStatistics().getMemoryStoreObjectCount(), is(1L)); TopUpResultService.TopUpStatusCacheEntry entry = (TopUpResultService.TopUpStatusCacheEntry) topUpStatusCache.get(PLAYER_ID).getObjectValue(); assertThat(entry.getTopUpStatus(), is(ACKNOWLEDGED)); assertThat(entry.getLastTopUpDate(), is(topUpAcknowledgeRequest.getTopUpDate())); verify(queuePublishingService, never()).send(topUpAcknowledgeRequest); }