@Test
public void test_addGroupToServiceAccount_oidc_successfully() {

    String token = "5PDrOhsy4ig8L3EpsJZSLAMg";
    ServiceAccountGroup serviceAccountGroup = new ServiceAccountGroup("svc_vault_test7", "group1", "reset");
    UserDetails userDetails = getMockUser(false);
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body("{\"messages\":[\"Group is successfully associated with Service Account\"]}");
    Response responseNoContent = getMockResponse(HttpStatus.NO_CONTENT, true, "");
    String [] policies = {"o_svcacct_svc_vault_test7"};
    when(policyUtils.getCurrentPolicies(token, userDetails.getUsername(), userDetails)).thenReturn(policies);
    Response groupResp = getMockResponse(HttpStatus.OK, true, "{\"data\":{\"bound_cidrs\":[],\"max_ttl\":0,\"policies\":[\"default\",\"w_shared_mysafe01\",\"w_shared_mysafe02\"],\"ttl\":0,\"groups\":\"admin\"}}");
    when(reqProcessor.process("/auth/ldap/groups","{\"groupname\":\"group1\"}",token)).thenReturn(groupResp);
    ObjectMapper objMapper = new ObjectMapper();
    String responseJson = groupResp.getResponse();
    try {
        List<String> resList = new ArrayList<>();
        resList.add("default");
        resList.add("w_shared_mysafe01");
        resList.add("w_shared_mysafe02");
        when(ControllerUtil.getPoliciesAsListFromJson(objMapper, responseJson)).thenReturn(resList);
    } catch (IOException e) {
        e.printStackTrace();
    }
    when(ControllerUtil.configureLDAPGroup(any(),any(),any())).thenReturn(responseNoContent);
    when(ControllerUtil.updateMetadata(any(),eq(token))).thenReturn(responseNoContent);
    when(tokenUtils.getSelfServiceToken()).thenReturn(token);
    when(reqProcessor.process(eq("/sdb"),Mockito.any(),eq(token))).thenReturn(getMockResponse(HttpStatus.OK, true, "{\"data\":{\"initialPasswordReset\":true,\"managedBy\":\"smohan11\",\"name\":\"svc_vault_test5\",\"users\":{\"smohan11\":\"sudo\"}}}"));
    
    ReflectionTestUtils.setField(serviceAccountsService, "vaultAuthMethod", "oidc");
    List<String> policie = new ArrayList<>();
    policie.add("default");
    policie.add("w_shared_mysafe02");
    policie.add("r_shared_mysafe01");
    List<String> currentpolicies = new ArrayList<>();
    currentpolicies.add("default");
    currentpolicies.add("w_shared_mysafe01");
    currentpolicies.add("w_shared_mysafe02");
    OIDCGroup oidcGroup = new OIDCGroup("123-123-123", currentpolicies);
    when(OIDCUtil.getIdentityGroupDetails("mygroup01", token)).thenReturn(oidcGroup);
    Response response = new Response();
    response.setHttpstatus(HttpStatus.NO_CONTENT);
    when(OIDCUtil.updateGroupPolicies(any(), any(), any(), any(), any())).thenReturn(response);
    
    ResponseEntity<String> responseEntity = serviceAccountsService.addGroupToServiceAccount(token, serviceAccountGroup, userDetails);
    assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected, responseEntity);
}