@Test(expected = RuntimeException.class)
  public void testEditTeamNoId() throws Exception {
    MockHttpServletRequest request = getRequest();
    String token = TokenUtil.generateSessionToken();

    // do NOT add the team id, but do add the team name, team description & token
    request.addParameter("team", "Team 1");
    request.addParameter("description", "description");
    request.addParameter("token", token);

    autoWireMock(editTeamController, new Returns(mockTeam), GrouperTeamService.class);
    autoWireMock(editTeamController, new Returns(true), ControllerUtil.class);
    autoWireRemainingResources(editTeamController);

    editTeamController.editTeam(getModelMap(), request, token, token, new SimpleSessionStatus());
  }
  @Test(expected = RuntimeException.class)
  public void testEditTeamNoMember() throws Exception {
    MockHttpServletRequest request = getRequest();
    String token = TokenUtil.generateSessionToken();
    // Add the teamId, team name, description & token
    request.addParameter("teamName", "Team 1");
    request.addParameter("team", "team-1");
    request.addParameter("description", "description");
    request.addParameter("token", token);

    GrouperTeamService grouperTeamService = mock(GrouperTeamService.class);
    when(grouperTeamService.findTeamById("team-1")).thenReturn(null);
    when(grouperTeamService.findMember("team-1", "member-1")).thenReturn(mockAdminMember);
    autoWireMock(editTeamController, grouperTeamService, GrouperTeamService.class);
    autoWireMock(editTeamController, new Returns(true), ControllerUtil.class);
    autoWireRemainingResources(editTeamController);

    editTeamController.editTeam(getModelMap(), request, token, token, new SimpleSessionStatus());
  }
  @Test
  public void testEditTeamHappyFlow() throws Exception {
    MockHttpServletRequest request = getRequest();
    String token = TokenUtil.generateSessionToken();
    // Add the teamId, team name, description & token
    request.addParameter("teamName", "Team 1");
    request.addParameter("team", "team-1");
    request.addParameter("description", "description");
    request.addParameter("token", token);

    GrouperTeamService grouperTeamService = mock(GrouperTeamService.class);
    when(grouperTeamService.findTeamById("team-1")).thenReturn(mockTeam);
    when(grouperTeamService.findMember("team-1", "member-1")).thenReturn(mockAdminMember);
    autoWireMock(editTeamController, grouperTeamService, GrouperTeamService.class);
    autoWireMock(editTeamController, new Returns(true), ControllerUtil.class);
    autoWireRemainingResources(editTeamController);

    RedirectView result =
        editTeamController.editTeam(
            getModelMap(), request, token, token, new SimpleSessionStatus());

    assertEquals("detailteam.shtml?team=team-1&view=app", result.getUrl());
  }