@Test
  public void
      isSimbaRestManagerAlive_WhenRoleServiceCallWasSuccessfulAndRoleDoesNotExist_ThenSimbaManagerIsAlive()
          throws Exception {
    String ssoToken = logInWithValidUser();
    when(simbaRoleServiceMock.findRoleByName(ssoToken, APP_USER_ROLE)).thenReturn(new SimbaRoleR());

    boolean actual = simbaManagerRestGateway.isSimbaRestManagerAlive();

    assertThat(actual).isTrue();
  }
  @Test
  public void
      isSimbaRestManagerAlive_WhenRoleServiceCallReturnsErrorStatus_ThenSimbaManagerIsNotAlive()
          throws Exception {
    String ssoToken = logInWithValidUser();
    when(simbaRoleServiceMock.findRoleByName(ssoToken, APP_USER_ROLE))
        .thenThrow(new IllegalArgumentException());

    boolean actual = simbaManagerRestGateway.isSimbaRestManagerAlive();

    assertThat(actual).isFalse();
  }
  @Test
  public void unassignRoleFromUser_WhenRolenameDoesNotExist_ThrowsIllegalArgumentException()
      throws Exception {
    String username = "******";
    String rolename = "role name";
    logInWithValidUser();
    when(simbaUserServiceMock.findUserByName(anyString(), eq(username)))
        .thenReturn(new SimbaUserR(username));
    when(simbaRoleServiceMock.findRoleByName(anyString(), eq(rolename)))
        .thenThrow(new IllegalArgumentException());

    expectedException.expect(IllegalArgumentException.class);

    simbaManagerRestGateway.unassignRoleFromUser(rolename, username);
  }
  @Test
  public void assignRoleToUser_AssignsLookedUpSimbaRoleToLookedUpSimbaUser() throws Exception {
    String username = "******";
    String rolename = "derp";

    String ssoToken = logInWithValidUser();
    SimbaRoleR simbaRole = new SimbaRoleR();
    SimbaUserR simbaUser = new SimbaUserR("simbauser");
    when(simbaRoleServiceMock.findRoleByName(ssoToken, rolename)).thenReturn(simbaRole);
    when(simbaUserServiceMock.findUserByName(ssoToken, username)).thenReturn(simbaUser);

    simbaManagerRestGateway.assignRoleToUser(rolename, username);

    verify(simbaGatewayMock, times(1)).login(APP_USER, APP_PASSWORD);
    verify(simbaRoleServiceMock, times(1)).findRoleByName(ssoToken, rolename);
    verify(simbaUserServiceMock, times(1)).findUserByName(ssoToken, username);
    verify(simbaRoleServiceMock, times(1)).addRoleToUser(ssoToken, simbaRole, simbaUser);
  }