@Test
  public void resolveExceptionShouldSetCountries() {
    long maxUploadSize = 1000;
    setUpPlayerProfile();

    final ModelAndView modelAndViewUnderTest =
        underTest.resolveException(
            request, response, null, new MaxUploadSizeExceededException(maxUploadSize));
    assertSame(
        countryRepository.getCountries(), modelAndViewUnderTest.getModelMap().get("countries"));
  }
  @Test
  public void resolveExceptionShouldSetGender() {
    long maxUploadSize = 1000;
    setUpPlayerProfile();

    final ModelAndView modelAndViewUnderTest =
        underTest.resolveException(
            request, response, null, new MaxUploadSizeExceededException(maxUploadSize));
    assertThat(
        genderRepository.getGenders(),
        is(equalTo(modelAndViewUnderTest.getModelMap().get("genders"))));
  }
  @Test
  public void resolveExceptionShouldSetPartial() {
    long maxUploadSize = 1000;
    setUpPlayerProfile();

    Boolean expectedPartialValue = Boolean.TRUE;
    request.setParameter(AbstractProfileController.PARTIAL_URI_FLAG, "true");
    ModelAndView modelAndViewUnderTest =
        underTest.resolveException(
            request, response, null, new MaxUploadSizeExceededException(maxUploadSize));

    assertEquals(
        expectedPartialValue,
        modelAndViewUnderTest.getModel().get(AbstractProfileController.PARTIAL_URI_FLAG));

    request.setParameter(AbstractProfileController.PARTIAL_URI_FLAG, "false");
    modelAndViewUnderTest =
        underTest.resolveException(
            request, response, null, new MaxUploadSizeExceededException(maxUploadSize));
    ProfileTestHelper.assertPartialFlagSetCorrectly(modelAndViewUnderTest, false);
  }
  @Test
  public void shouldReturnDefaultViewOnErrorWhenMaxUploadSizeExceeded() {
    setUpPlayerProfile();
    long maxUploadSize = 1000;

    DisplayName expectedDisplayName = new DisplayName("displayName");
    PlayerProfile expectedUserProfile = getUserProfile();
    ModelAndView modelAndView =
        underTest.resolveException(
            request, response, null, new MaxUploadSizeExceededException(maxUploadSize));
    verify(lobbyExceptionHandler)
        .setCommonPropertiesInModelAndView(request, response, modelAndView);

    final ModelMap modelMap = modelAndView.getModelMap();
    assertEquals(
        expectedDisplayName, modelMap.get(PlayerProfileController.DISPLAY_NAME_OBJECT_KEY));
    assertEquals(expectedUserProfile, modelMap.get(PlayerProfileController.PLAYER_OBJECT_KEY));
    assertMainProfilePageViewName(modelAndView);
  }
 @Test
 public void resolveExceptionShouldReturnNullForExceptionsExceptMaxUploadSizeExceeded() {
   assertNull(underTest.resolveException(request, response, null, new Exception()));
 }