コード例 #1
0
  @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()));
  }
コード例 #2
0
  @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);
  }