@Test
  public void createRequestSetsRequestIdInResponse() {
    final TrophyLeaderboardCreationResponse response = unit.process(request);

    assertThat(response, is(not(nullValue())));
    assertThat(response.getRequestSpaceId(), is(equalTo(REQUEST_SPACE_ID)));
  }
  @SuppressWarnings({"ThrowableInstanceNeverThrown"})
  @Test
  public void createRequestWithErrorSetsRequestIdInResponse() {
    final TrophyLeaderboardCreationResponse response = unit.process(request);

    doThrow(new RuntimeException("TestEx")).when(trophyLeaderboardRepository).save(leaderboard);

    assertThat(response, is(not(nullValue())));
    assertThat(response.getRequestSpaceId(), is(equalTo(REQUEST_SPACE_ID)));
  }
  @Test
  public void createRequestGetsNewIdAndSavesToRepository() {
    final TrophyLeaderboardCreationResponse response = unit.process(request);

    assertThat(response, is(not(nullValue())));
    assertThat(response.getStatus(), is(Status.SUCCESS));
    assertThat(leaderboard.getId(), is(equalTo(NEW_ID)));

    verify(trophyLeaderboardRepository).save(leaderboard);
  }
  @SuppressWarnings({"ThrowableInstanceNeverThrown"})
  @Test
  public void createRequestCatchesExceptionAndReturnsError() {
    doThrow(new RuntimeException("TestEx"))
        .when(trophyLeaderboardRepository)
        .save(any(TrophyLeaderboard.class));

    final TrophyLeaderboardCreationResponse response = unit.process(request);

    assertThat(response, is(not(nullValue())));
    assertThat(response.getTrophyLeaderboardId(), is(nullValue()));
    assertThat(response.getStatus(), is(Status.FAILURE));
  }
  @Test
  public void processReturnsNullOnNullRequest() {
    final TrophyLeaderboardCreationResponse response = unit.process(null);

    assertThat(response, is(nullValue()));
  }
  @Test
  public void templateIsEmptyRequest() {
    final TrophyLeaderboardCreationRequest template = unit.eventTemplate();

    assertThat(template, is(equalTo(new TrophyLeaderboardCreationRequest())));
  }