Skip to content

Conversation

@muskan124947
Copy link
Contributor

@muskan124947 muskan124947 commented Nov 4, 2025

Overview

Gradle Test job was failing with MockitoException errors when running builds with newer JDK versions (JDK 25). The Gradle build was using a single Mockito version for all JDK profiles, unlike the Maven build which already had profile-specific dependency management.

Below are some Error Examples:

SQLServerConnectionTest > testConnectionRecoveryCheckDoesNotThrowWhenRoutingDetailsNotNull() FAILED
    org.mockito.exceptions.base.MockitoException at SQLServerConnectionTest.java:1564
        Caused by: java.lang.IllegalStateException at SQLServerConnectionTest.java:1564
            Caused by: java.lang.IllegalArgumentException at SQLServerConnectionTest.java:1564

TDSTokenHandlerTest > testSeverity20FatalErrorSimulation() FAILED
    org.mockito.exceptions.base.MockitoException at TDSTokenHandlerTest.java:31
        Caused by: java.lang.IllegalStateException at TDSTokenHandlerTest.java:31

Problem Description

  • Single Mockito version for all JDK profiles: Gradle build used Mockito 4.11.0 for all JDK versions (8, 11, 17, 21, 25)
  • JDK compatibility issues: Mockito 4.11.0 is incompatible with Java 25, causing test failures
  • Inconsistent with pom.xml: Maven already had profile-specific Mockito versions, but build.gradle didn’t follow the same pattern
  • Pipeline test failures: Modern JDK builds were failing due to Mockito compatibility issues

Resolution Steps

Use below combination of dependency versions with respective JRE profiles:

JDK Profile Mockito Core Mockito Inline Byte Buddy
JRE 8 4.11.0 4.11.0 1.15.11
JRE 11 5.14.2 ❌ (not needed) 1.17.5
JRE 17 5.14.2 ❌ (not needed) 1.17.5
JRE 21 5.14.2 ❌ (not needed) 1.17.5
JRE 25 5.14.2 ❌ (not needed) 1.17.5

@muskan124947 muskan124947 self-assigned this Nov 4, 2025
@muskan124947 muskan124947 changed the title Update Mockito dependencies for JDK profile compatibility Update Mockito dependencies for different JDK profiles(8,11,17,21,25) compatibility Nov 4, 2025
@muskan124947 muskan124947 merged commit 70e07cf into main Nov 4, 2025
6 checks passed
@muskan124947 muskan124947 added this to the 13.3.0 milestone Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants