@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
      getTopUpResultShouldCacheResultWhenPlayerHasNoCachedResultAndLastTopUpIsAcknowledged() {
    final TopUpResult topUpResult = new TopUpResult(PLAYER_ID, ACKNOWLEDGED, new DateTime());
    when(dailyAwardPromotionService.getTopUpResult(PLAYER_ID, WEB)).thenReturn(topUpResult);

    final TopUpResult actualTopUpResult = underTest.getTopUpResult(PLAYER_ID, WEB);

    // check that result wasn't cached before
    assertThat(topUpStatusCache.getStatistics().getCacheHits(), is(0L));
    // check that result was cached after
    assertThat(topUpStatusCache.getStatistics().getMemoryStoreObjectCount(), is(1L));
    // check cache entry
    TopUpResultService.TopUpStatusCacheEntry entry =
        (TopUpResultService.TopUpStatusCacheEntry) topUpStatusCache.get(PLAYER_ID).getObjectValue();
    assertThat(entry.getTopUpStatus(), is(ACKNOWLEDGED));
    assertThat(entry.getLastTopUpDate(), is(topUpResult.getLastTopUpDate()));

    assertThat(actualTopUpResult, is(topUpResult));
  }
  @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);
  }