Skip to content

Fix response parsing in shaded builds and modernize test environment (Closes #363, Fixes #41, Fixes #333) - #346

Open
maheshshinde9100 wants to merge 2 commits into
razorpay:masterfrom
maheshshinde9100:master
Open

Fix response parsing in shaded builds and modernize test environment (Closes #363, Fixes #41, Fixes #333)#346
maheshshinde9100 wants to merge 2 commits into
razorpay:masterfrom
maheshshinde9100:master

Conversation

@maheshshinde9100

@maheshshinde9100 maheshshinde9100 commented Jan 30, 2026

Copy link
Copy Markdown

Summary

This pull request fixes response parsing failures when the SDK is shaded or relocated and modernizes the test infrastructure to support current Java versions.

Problem

ApiClient.java relied on a hardcoded com.razorpay. package name while resolving entity classes through reflection. When the SDK was shaded into a different namespace, reflection failed, resulting in response parsing errors reported in #41 and #333.

The existing test setup also depended on legacy Mockito APIs that are incompatible with modern JDKs.

Changes

  • Use dynamic package resolution (getClass().getPackage().getName()) instead of hardcoded package names.

  • Add a safety check in parseResponse().

  • Upgrade Mockito to 4.11.0.

  • Upgrade JaCoCo to 0.8.11.

  • Configure Maven Surefire for Java 17+ compatibility.

  • Replace deprecated Mockito APIs:

    • anyObject()any()
    • initMocks()openMocks()
  • Remove the duplicate org.json dependency from pom.xml.

Impact

Verification

  • mvn clean compile
  • mvn test
  • ✅ All 170 unit tests passed on Java 21.

Closes

 to throw a clear RazorpayException if an entity class cannot be found, rather than failing with a NullPointerException
- Resolve response parsing errors in shaded/re-packaged environments (razorpay#333)
- Update Mockito and Jacoco for modern JDK compatibility
- Fix deprecated Mockito matchers in BaseTest
@maheshshinde9100 maheshshinde9100 changed the title Fix response parsing in shaded builds and modernize test environment (#41, #333) Fix response parsing in shaded builds and modernize test environment (Closes #363, Fixes #41, Fixes #333) Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant