Upgrade PowerMock 1.7.4 → 2.0.9; replace deprecated Mockito Matchers API#1004
Open
Upgrade PowerMock 1.7.4 → 2.0.9; replace deprecated Mockito Matchers API#1004
Conversation
…Matchers Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/6b8eb99d-3f76-42c6-9848-34782ea3487a Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update PowerMock dependencies to version 2.0.9
Upgrade PowerMock 1.7.4 → 2.0.9; replace deprecated Mockito Matchers API
Apr 16, 2026
… license-manager-cli pom Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/7cf6d7a0-2e60-423d-8d1e-6627556d89f7 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
…x API Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/7a915422-19c9-4fbf-823f-edbbf6b07dfc Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
…2.x compatibility Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/748d1cc8-2850-44df-abad-b056d6b32b5d Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
…r changes Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/ff049a3e-2689-453f-b840-f98cba9e5f3e Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
- OpenAMScopeValidatorTest: use nullable(String.class) in getResourceOwnerIdentity stub; use literal string in getResourceOwnerId thenReturn (anyString() used as return value was returning null) - OpenAMResourceSetStoreTest: use nullable(String.class) in getResourceSetRegistrationPolicyEndpoint stub (resource set ID is null before it gets generated) - ResourceSetRegistrationEndpointTest: use nullable(String.class) in resourceSetCreated verify (realm param is null); add store.read stub for delete test so updateLabelsForDeletedResourceSet gets non-null arg - AccessTokenServiceTest: use nullable(String.class) in createAccessToken and createRefreshToken stubs (several args are always null) - AuthorizationCodeGrantTypeHandlerTest: use nullable(String.class) in tokenInvalidator.invalidateTokens verify and in createAccessToken / createRefreshToken stubs (grantType, resourceOwnerId, nonce, etc are null from unstubbed mocks) Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/df2c22cb-937a-4145-8f42-5ec58a64639b Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
- AuthorizationCodeGrantTypeHandlerTest: verify(accessToken).addExtraData(
eq("nonce"), anyString()) fails because authorizationCode.getNonce() is
null on an unstubbed mock; changed to nullable(String.class) in all
three shouldHandle* tests
- AccessTokenServiceTest.shouldReturnNewRefreshTokenIdWhenRefreshing:
createRefreshToken stub had anyString() for authGrantId (position 8)
but refreshToken.getAuthGrantId() returns null on an unstubbed mock;
changed to nullable(String.class)
Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/bf83acfc-2e36-4665-a516-c6383bcf0e7d
Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/43f8f22d-f1ee-4ba2-97e0-909821e51726 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
…eEntitlementSubConfigsStepTest Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/3b5c1155-ad20-4a02-9d22-3ddc188c00a1 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/eca7f47e-e313-4e13-8615-f20c5e741a81 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
…oid flaky IT test failures Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/4123b9ed-4e9c-45b6-be2f-0088d4b3f336 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
…61 PR-changed Java files Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenAM/sessions/14b2ba10-f354-4f36-ae31-50898ca56a55 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Member
|
@copilot merge maximthomas:issues/stabilize-integration-test |
Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Contributor
Author
Merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Portions copyright 2025 3A Systems LLC.→ updated toPortions copyright 2025-2026 3A Systems, LLC.Copyright YYYY 3A Systems LLC.(sole author) → updated year to include 2026Portions copyright 2026 3A Systems, LLC.Portions copyright 2026 3A Systems, LLC.maximthomas:issues/stabilize-integration-test: upgrade Selenium to 4.43.0 and testcontainers to 1.21.4, further stabilizeIT_SetupWithOpenDJ, set logback to WARN level in testsOriginal prompt
The CI build is failing because PowerMock 1.7.4's bundled javassist cannot handle newer JDK bytecode (
invalid constant type: 18error), causingSessionServerConfigTestto fail instantiation.Reference failing PR: #1003
Required changes:
openam-core/pom.xml(lines 420-443): Update all PowerMock dependencies from version1.7.4to2.0.9, and change the artifactpowermock-api-mockitotopowermock-api-mockito2:Search the entire repo for any other
pom.xmlfiles that declare PowerMock dependencies at version1.7.4and update them the same way.Search the entire repo for all Java test files that import
org.mockito.Matchersand replace withorg.mockito.ArgumentMatchers(Mockito 2.x renamedMatcherstoArgumentMatchers). Known instance:openam-core/src/test/java/com/iplanet/dpro/session/service/SessionServerConfigTest.javaline 16: changeimport static org.mockito.Matchers.anyStringtoimport static org.mockito.ArgumentMatchers.anyStringAlso search for
import org.mockito.Matchers(non-static) and update those as well.If
mockito-allis used as a dependency, it may need to be replaced withmockito-corefor compatibility with PowerMock 2.x. Check and update if needed.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for failing job 71654684251. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant:
Failing Job Analysis
The build failure in job
71654684251is caused by PowerMock 1.7.4's bundled javassist being incompatible with the JDK version used in CI. The root error is:invalid constant type: 18refers toCONSTANT_InvokeDynamic, which older versions of javassist (bundled with PowerMock 1.7.4) cannot parse from newer JDK-compiled bytecode.Solution
The best fix is to upgrade PowerMock to 2.x (which uses a compatible javassist) and update the Mockito imports accordingly. In
openam-core/pom.xml, update the PowerMock dependencies:Note the artifact change from
powermock-api-mockito→powermock-api-mockito2.Then in
SessionServerConfigTest.java, update the deprecated Mockito import:If upgrading PowerMock is not feasible, an alternative minimal fix is to add an explicit newer javassist dependency to override the one bundled with PowerMock 1.7.4:
The upgrade path is recommended as PowerMock 1.7.x is EOL and has known issues with modern JDKs.
User: make PR upgrade PowerMock to 2.x
Assistant: I've started a Copilot coding session to create a PR that upgrades PowerMock from 1.7.4 to 2.0.9 in the
OpenIdentityPlatform/OpenAMrepository. The agent will...This pull request was created from Copilot chat.