From 1ced0283c68abd255841bafc59fb0eec091fbfd3 Mon Sep 17 00:00:00 2001 From: SujanSanjula96 Date: Fri, 3 Jan 2025 14:31:12 +0530 Subject: [PATCH] Add verification for revokeAccessTokens method invocation --- .../java/org/wso2/carbon/identity/oauth/OAuthUtilTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/org.wso2.carbon.identity.oauth/src/test/java/org/wso2/carbon/identity/oauth/OAuthUtilTest.java b/components/org.wso2.carbon.identity.oauth/src/test/java/org/wso2/carbon/identity/oauth/OAuthUtilTest.java index 1ccb40e5c4..f6e982060a 100644 --- a/components/org.wso2.carbon.identity.oauth/src/test/java/org/wso2/carbon/identity/oauth/OAuthUtilTest.java +++ b/components/org.wso2.carbon.identity.oauth/src/test/java/org/wso2/carbon/identity/oauth/OAuthUtilTest.java @@ -60,6 +60,8 @@ import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -285,6 +287,7 @@ public void testRevokeTokensForApplicationAudienceRoles() throws Exception { any(AuthenticatedUser.class), nullable(String.class), anyBoolean())).thenReturn(accessTokens); boolean result = OAuthUtil.revokeTokens(username, userStoreManager, roleId); + verify(mockAccessTokenDAO, times(1)).revokeAccessTokens(any(), anyBoolean()); assertTrue(result, "Token revocation failed."); }