OIDCAuthService { public ResponseEntity<String> updateIdentityGroupByName(String token, OIDCIdentityGroupRequest oidcIdentityGroupRequest) { log.debug(JSONUtil.getJSON(ImmutableMap.<String, String> builder() .put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)) .put(LogMessage.ACTION, "Update Identity Group By Name") .put(LogMessage.MESSAGE, "Trying to update identity group entity by name") .put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).build())); String canonicalID = oidcUtil.updateIdentityGroupByName(token, oidcIdentityGroupRequest); if (canonicalID != null) { return ResponseEntity.status(HttpStatus.OK).body(canonicalID); } else { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("{\"errors\":[\"Failed to get Canonical ID\"]}"); } }  ResponseEntity<String> getAuthenticationMounts(String token); ResponseEntity<OIDCEntityResponse> entityLookUp(String token,
			OIDCLookupEntityRequest oidcLookupEntityRequest); ResponseEntity<String> groupEntityLookUp(String token, OIDCLookupEntityRequest oidcLookupEntityRequest); ResponseEntity<String> readEntityAliasById(String token, String id); ResponseEntity<String> readEntityByName(String token, String entityName); ResponseEntity<String> updateEntityByName(String token, OIDCEntityRequest oidcEntityRequest); ResponseEntity<String> updateIdentityGroupByName(String token,
                                                            OIDCIdentityGroupRequest oidcIdentityGroupRequest); ResponseEntity<String> readGroupAliasById(String token, String id); ResponseEntity<String> deleteGroupByName(String token, String name); ResponseEntity<String> deleteGroupAliasByID(String token, String id); ResponseEntity<String> createGroupAlias(String token, GroupAliasRequest groupAliasRequest); ResponseEntity<String> getAuthUrl(OidcRequest oidcRequest); ResponseEntity<String> processOIDCCallback(String state, String code); ResponseEntity<String> getGroupObjectIdFromAzure(String groupName); ResponseEntity<String> getIdentityGroupDetails(String groupName, String token); ResponseEntity<String> getUserName(UserDetails userDetails); ResponseEntity<DirectoryObjects> searchGroupInAzureAD(String groupName);  }
@Test public void updateIdentityGroupByName() throws Exception { String token = "4EpPYDSfgN2D4Gf7UmNO3nuL"; String name = "name"; OIDCIdentityGroupRequest oidcIdentityGroupRequest = new OIDCIdentityGroupRequest(); oidcIdentityGroupRequest.setMember_group_ids(null); oidcIdentityGroupRequest.setMember_entity_ids(null); Map<String, String> metadata = new HashMap<String, String>(); metadata.put("organization", "t-vault"); oidcIdentityGroupRequest.setMetadata(metadata); oidcIdentityGroupRequest.setPolicies(null); oidcIdentityGroupRequest.setName(name); String jsonStr = JSONUtil.getJSON(oidcIdentityGroupRequest); Response response = getMockResponse(HttpStatus.OK, true, "{\"data\": [\"safeadmin\",\"vaultadmin\"]]"); String canonicalId ="123-333-33as"; when(OIDCUtil.updateIdentityGroupByName(token, oidcIdentityGroupRequest)).thenReturn(canonicalId); ResponseEntity<String> responseEntity = oidcAuthService.updateIdentityGroupByName(token, oidcIdentityGroupRequest); assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); assertEquals(canonicalId, responseEntity.getBody()); }