@Test
public void synchronizeTeamsShouldRemoveMembershipsOfUnmappedTeams() {

    when(configMock.getProperty(eq(Config.AlpineKey.OIDC_TEAMS_CLAIM)))
            .thenReturn("teams");
    final OidcUserInfo userInfo = new OidcUserInfo();
    userInfo.setClaim("teams", Collections.singletonList("groupName"));
    try (final AlpineQueryManager qm = new AlpineQueryManager()) {
        OidcUser oidcUser = new OidcUser();
        oidcUser.setUsername("username");
        oidcUser.setSubjectIdentifier("subject");
        oidcUser = qm.persist(oidcUser);
        Team team = new Team();
        team.setName("teamName");
        team.setOidcUsers(Collections.singletonList(oidcUser));
        qm.persist(team);
        final OidcAuthenticationService authService = new OidcAuthenticationService(configMock, oidcConfigurationMock, ACCESS_TOKEN);
        oidcUser = authService.synchronizeTeams(qm, oidcUser, userInfo);
        assertThat(oidcUser.getTeams()).isNullOrEmpty();
    }
}