Skip to content

Commit

Permalink
Improve the formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Malith-19 committed Feb 14, 2025
1 parent a4bda37 commit fa55801
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,16 @@ public class IdentityOathEventListenerTest extends IdentityBaseTest {

private final String credentialUpdateUsername = "testUsername";
private final String newCredential = "newPassword1$";

@Mock
OAuth2ServiceComponentHolder oAuth2ServiceComponentHolder;
private IdentityOathEventListener identityOathEventListener;

@Mock
private AbstractUserStoreManager abstractUserStoreManager;

@Mock
private OAuth2RevocationProcessor oAuth2RevocationProcessor;

@Mock
private OrganizationManager organizationManager;

private MockedStatic<OAuth2ServiceComponentHolder> oAuth2ServiceComponentHolderMockedStatic;

@Mock
OAuth2ServiceComponentHolder oAuth2ServiceComponentHolder;

private MockedStatic<OAuthComponentServiceHolder> oAuthComponentServiceHolderMockedStatic;

@Mock
Expand All @@ -82,7 +75,6 @@ public class IdentityOathEventListenerTest extends IdentityBaseTest {
@Mock
private UserRealm userRealm;


@BeforeMethod
public void setUp() {

Expand Down Expand Up @@ -123,13 +115,16 @@ private void prepareForCredentialUpdate() throws UserStoreException, Organizatio
userAssociationList.add(userAssociation);

when(oAuth2ServiceComponentHolder.getRevocationProcessor()).thenReturn(oAuth2RevocationProcessor);
when(oAuth2RevocationProcessor.revokeTokens(credentialUpdateUsername, abstractUserStoreManager)).thenReturn(false);
when(oAuth2RevocationProcessor.revokeTokens(credentialUpdateUsername, abstractUserStoreManager)).thenReturn(
false);
when(abstractUserStoreManager.getUser(null, credentialUpdateUsername)).thenReturn(user);
when(abstractUserStoreManager.getTenantId()).thenReturn(tenantId);
when(IdentityTenantUtil.getTenantDomain(tenantId)).thenReturn(tenant);
when(organizationManager.resolveOrganizationId(tenant)).thenReturn(orgId);
when(oAuthComponentServiceHolder.getOrganizationUserSharingService()).thenReturn(organizationUserSharingService);
when(organizationUserSharingService.getUserAssociationsOfGivenUser(userID, orgId)).thenReturn(userAssociationList);
when(oAuthComponentServiceHolder.getOrganizationUserSharingService()).thenReturn(
organizationUserSharingService);
when(organizationUserSharingService.getUserAssociationsOfGivenUser(userID, orgId)).thenReturn(
userAssociationList);
when(oAuthComponentServiceHolder.getOrganizationManager()).thenReturn(organizationManager);
when(organizationManager.resolveTenantDomain(orgIdUserAssociation)).thenReturn(tenantUserAssociation);
when(oAuthComponentServiceHolder.getRealmService()).thenReturn(realmService);
Expand All @@ -142,11 +137,13 @@ private void prepareForCredentialUpdate() throws UserStoreException, Organizatio
public void testDoPostUpdateCredential() throws UserStoreException, OrganizationManagementException {

prepareForCredentialUpdate();
identityOathEventListener.doPostUpdateCredential(credentialUpdateUsername, newCredential, abstractUserStoreManager);
identityOathEventListener.doPostUpdateCredential(credentialUpdateUsername, newCredential,
abstractUserStoreManager);
}

@Test
public void testDoPostUpdateCredentialByAdmin() throws UserStoreException, OrganizationManagementException {

prepareForCredentialUpdate();
identityOathEventListener.doPostUpdateCredentialByAdmin(credentialUpdateUsername, newCredential,
abstractUserStoreManager);
Expand Down

0 comments on commit fa55801

Please sign in to comment.