Skip to content

Conversation

@carlspring
Copy link
Collaborator

@carlspring carlspring commented Jan 30, 2026

Fixes #71.

  • Upgraded the GitHub actions.
  • Upgraded the JDK to 22 or higher.
  • Upgraded Gradle to newest possible 9.x.
  • Upgraded Mockito.
  • Upgrade JUnit.

Summary by CodeRabbit

  • Chores
    • Updated minimum Java version requirement to 21
    • Upgraded Gradle build tool from 8.2 to 9.2.1
    • Updated dependencies: commons-codec (1.10 → 1.19.0) and commons-io (2.7 → 2.21.0)
    • Upgraded test framework to JUnit 5

✏️ Tip: You can customize this high-level summary in your review settings.

@carlspring carlspring marked this pull request as draft January 30, 2026 18:21
@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Walkthrough

The PR upgrades the Java toolchain from 1.7/1.8 to Java 21, updates Gradle from 8.2 to 9.2.1, migrates test framework from JUnit 4 to JUnit 5, and updates dependencies (commons-codec and commons-io). The CI workflow is simplified to run with Java 21 only.

Changes

Cohort / File(s) Summary
Build Configuration
.github/workflows/build.yml, build.gradle.kts, gradle.properties, gradle/wrapper/gradle-wrapper.properties
Updates Java toolchain to 21, Gradle to 9.2.1, dependencies (commons-codec 1.10→1.19.0, commons-io 2.7→2.21.0), and framework JUnit 4→5. Adds JVM args for reflective access. CI matrix simplified to single Java 21 job.
Test Migration
src/test/java/com/uploadcare/api/FileTest.java, src/test/java/com/uploadcare/api/RequestHelperTest.java, src/test/java/com/uploadcare/upload/FileUploaderTest.java, src/test/java/com/uploadcare/urls/CdnPathBuilderTest.java
Migrates tests from JUnit 4 to JUnit 5: updates imports and annotations (@Test, @Before@beforeeach), reduces class/method visibility to package-private, standardizes method names to camelCase (test_* → test*).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the pull request: upgrading the JDK to version 21 or higher, which is the primary focus of all changes.
Linked Issues check ✅ Passed The pull request successfully addresses all coding requirements from issue #71: JDK upgraded to Java 21, Gradle upgraded to 9.2.1, JUnit migrated to version 5, dependencies updated, and GitHub Actions workflow updated.
Out of Scope Changes check ✅ Passed All changes are directly related to the JDK upgrade objective; test visibility changes and method naming follow standard Java conventions for migrating to JUnit 5 and are necessary for the framework upgrade.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issues/71-upgrade-jdk-gradle-dependencies

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
build.gradle.kts (1)

105-110: ⚠️ Potential issue | 🟡 Minor

POM properties still reference Java 1.7 - inconsistent with Java 21 toolchain.

The maven.compiler.target and maven.compiler.source are set to 1.7, but the project now uses Java 21 toolchain. This inconsistency may confuse downstream consumers of the published artifact.

🔧 Proposed fix
                 properties = mapOf(
                     "project.build.sourceEncoding" to "UTF-8",
                     "project.reporting.outputEncoding" to "UTF-8",
-                    "maven.compiler.target" to "1.7",
-                    "maven.compiler.source" to "1.7"
+                    "maven.compiler.target" to "21",
+                    "maven.compiler.source" to "21"
                 )
src/test/java/com/uploadcare/upload/FileUploaderTest.java (1)

21-22: ⚠️ Potential issue | 🟠 Major

org.mockito.Matchers is deprecated - use ArgumentMatchers.

org.mockito.Matchers has been deprecated since Mockito 2.x and removed in later versions. When upgrading Mockito (as recommended in build.gradle.kts), this will cause compilation failures.

🔧 Proposed fix
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.eq;
.github/workflows/build.yml (1)

26-35: ⚠️ Potential issue | 🟡 Minor

Update GitHub Actions to current versions.

The actions used are on older major versions:

  • actions/checkout@v3 → v6 is the current latest (v4 is still supported)
  • actions/setup-java@v3 → v5 is the current latest (v4 is still supported)
  • gradle/gradle-build-action@v2 is deprecated in favor of gradle/actions/setup-gradle@v5
🔄 Proposed updates
     steps:
       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4

       - name: Setup JDK
-        uses: actions/setup-java@v3
+        uses: actions/setup-java@v4
         with:
           java-version: ${{ matrix.java }}
           distribution: 'temurin'

       - name: Setup Gradle
-        uses: gradle/gradle-build-action@v2
+        uses: gradle/actions/setup-gradle@v5
           # Removing unused files from Gradle User Home before saving to cache (i.e. older versions of gradle)
           gradle-home-cache-cleanup: true
           # Cache downloaded JDKs in addition to the default directories.
           gradle-home-cache-includes: |
             caches
             notifications
             jdks
🤖 Fix all issues with AI agents
In `@build.gradle.kts`:
- Around line 28-29: The build declares a non-existent Commons IO version
("commons-io:commons-io:2.21.0") which will break the Gradle build; update the
dependency declaration in build.gradle.kts to a valid Maven Central version (for
example change the version from 2.21.0 to 2.16.1 or 2.15.1) so the
implementation("commons-io:commons-io:<version>") entry resolves; leave the
JUnit BOM/testImplementation lines as-is since JUnit 6.0.1 is valid.
- Line 36: Replace the deprecated dependency declaration
testImplementation("org.mockito:mockito-all:1.10.19") with the modern Mockito
artifacts for JUnit 5: add
testImplementation("org.mockito:mockito-core:<latest-version>") and
testImplementation("org.mockito:mockito-junit-jupiter:<latest-version>") in
build.gradle.kts, then update tests using Mockito to use the JUnit 5 extension
by annotating test classes with `@ExtendWith`(MockitoExtension.class) (or migrate
to `@Mock/`@InjectMocks with MockitoExtension) to ensure compatibility.

In `@src/test/java/com/uploadcare/api/RequestHelperTest.java`:
- Around line 28-36: The test in RequestHelperTest calls RequestHelper.rfc2822
and then asserts the result against itself (assertEquals(formattedDate,
formattedDate)), which always passes; change the assertion to compare the
produced formattedDate to the expected constant FORMATTED_DATE (e.g.,
assertEquals(FORMATTED_DATE, formattedDate)) so the test actually verifies
RequestHelper.rfc2822 output; locate the assertion in method testRfc2822 and
update it accordingly.

Comment on lines +28 to +29
testImplementation(platform("org.junit:junit-bom:6.0.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# Check JUnit BOM 6.0.1 existence
echo "=== Checking JUnit BOM 6.0.1 ==="
http_code=$(curl -s -o /dev/null -w "%{http_code}" "https://repo1.maven.org/maven2/org/junit/junit-bom/6.0.1/junit-bom-6.0.1.pom")
echo "HTTP Status for JUnit BOM 6.0.1: $http_code"

# Check available JUnit BOM versions
echo ""
echo "=== Available JUnit BOM versions (latest 15) ==="
curl -s "https://repo1.maven.org/maven2/org/junit/junit-bom/maven-metadata.xml" 2>/dev/null | grep -o '<version>[^<]*</version>' | sed 's/<version>//g' | sed 's/<\/version>//g' | tail -15

# Check commons-io version
echo ""
echo "=== Checking commons-io 2.21.0 ==="
http_code=$(curl -s -o /dev/null -w "%{http_code}" "https://repo1.maven.org/maven2/org/apache/commons/commons-io/2.21.0/commons-io-2.21.0.pom")
echo "HTTP Status for commons-io 2.21.0: $http_code"

# Check available commons-io versions
echo ""
echo "=== Available commons-io versions (latest 10) ==="
curl -s "https://repo1.maven.org/maven2/org/apache/commons/commons-io/maven-metadata.xml" 2>/dev/null | grep -o '<version>[^<]*</version>' | sed 's/<version>//g' | sed 's/<\/version>//g' | tail -10

# Check mockito-all availability
echo ""
echo "=== Checking mockito-all 1.10.19 ==="
http_code=$(curl -s -o /dev/null -w "%{http_code}" "https://repo1.maven.org/maven2/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19.jar")
echo "HTTP Status for mockito-all 1.10.19: $http_code"

# Check available mockito versions
echo ""
echo "=== Available mockito-core versions (latest 10) ==="
curl -s "https://repo1.maven.org/maven2/org/mockito/mockito-core/maven-metadata.xml" 2>/dev/null | grep -o '<version>[^<]*</version>' | sed 's/<version>//g' | sed 's/<\/version>//g' | tail -10

Repository: uploadcare/uploadcare-java

Length of output: 650


JUnit BOM 6.0.1 is a valid release — JUnit 6 is a legitimate production version line with official releases including 6.0.0, 6.0.1, and 6.0.2 on Maven Central. No issue here.

However, commons-io 2.21.0 (line 25) does not exist on Maven Central (HTTP 404). This will cause the gradle build to fail. Update to a valid version such as 2.15.1 or 2.16.1.

🤖 Prompt for AI Agents
In `@build.gradle.kts` around lines 28 - 29, The build declares a non-existent
Commons IO version ("commons-io:commons-io:2.21.0") which will break the Gradle
build; update the dependency declaration in build.gradle.kts to a valid Maven
Central version (for example change the version from 2.21.0 to 2.16.1 or 2.15.1)
so the implementation("commons-io:commons-io:<version>") entry resolves; leave
the JUnit BOM/testImplementation lines as-is since JUnit 6.0.1 is valid.

testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")

testImplementation("org.hamcrest:hamcrest:2.2")
testImplementation("org.mockito:mockito-all:1.10.19")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

mockito-core Java 21 compatibility latest version 2024 2025

💡 Result:

  • Mockito + Java 21: Mockito 5.x is the line that works with Java 21; Mockito 4.11.0 was reported broken on Java 21 due to needing a newer Byte Buddy, while “the latest version of Mockito 5 works fine with Java 21.” [2]
  • Latest mockito-core (as of Jan 30, 2026): org.mockito:mockito-core:5.21.0 (published 2025-12-09). [1]
  • Relevant 2024–2025 releases (from Maven Central timestamps): 5.10.0 (2024-01-24), 5.11.0 (2024-03-01), 5.12.0 (2024-05-11), 5.13.0 (2024-08-27), 5.14.x (2024-09/10), 5.15.2 (2025-01-02), 5.16.x (2025-03), 5.17.0 (2025-04-04), 5.18.0 (2025-05-20), 5.19.0 (2025-08-15), 5.20.0 (2025-09-20), 5.21.0 (2025-12-09). [1]
  • Note if you used mockito-inline: Mockito maintainers state inline mocking is the default since Mockito 5 and you should use mockito-core latest instead of relying on a separate mockito-inline artifact. [3]

Recommendation for Java 21: use org.mockito:mockito-core:5.21.0. [1]

Sources: [1] https://repo1.maven.org/maven2/org/mockito/mockito-core/ , [2] mockito/mockito#3143 , [3] https://groups.google.com/g/mockito/c/psRyztIa5mY


🌐 Web query:

mockito-all incompatible JUnit 5 mockito-core replacement

💡 Result:

mockito-all is the old “fat jar” distribution (mainly for manual/legacy builds) and was discontinued starting with Mockito 2.x—so it’s a bad fit for modern JUnit 5 projects. Replace it with mockito-core + mockito-junit-jupiter. [1], [2]

Maven (JUnit 5 / Jupiter)

<dependency>
  <groupId>org.mockito</groupId>
  <artifactId>mockito-core</artifactId>
  <version>${mockito.version}</version>
  <scope>test</scope>
</dependency>

<dependency>
  <groupId>org.mockito</groupId>
  <artifactId>mockito-junit-jupiter</artifactId>
  <version>${mockito.version}</version>
  <scope>test</scope>
</dependency>

mockito-junit-jupiter provides the JUnit 5 extension:

`@ExtendWith`(MockitoExtension.class)
class MyTest { ... }

[2], [3]

Gradle

testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion"

[1], [2]

If you relied on mockito-all bundling extra deps

Because mockito-all used to bundle some transitive dependencies, you may need to add what your project actually uses explicitly (commonly Hamcrest, depending on your assertions/matchers). [4]

Sources: Mockito site (recommends mockito-core, notes mockito-all discontinued) [1]; JUnit 5 usage via mockito-junit-jupiter / MockitoExtension [2]; artifact exists on Maven Central [3]; mockito-all vs mockito-core differences/discontinuation note [4].

[1] (site.mockito.org)
[2] (stackoverflow.com)
[3] (central.sonatype.com)
[4] (stackoverflow.com)

Citations:


🌐 Web query:

mockito-all 1.10.19 release date 2014

💡 Result:

org.mockito:mockito-all:1.10.19 was released to Maven Central on December 31, 2014 (artifacts timestamped 2014-12-31 16:43). [1], [2]


Replace mockito-all with mockito-core and mockito-junit-jupiter for JUnit 5 compatibility.

mockito-all:1.10.19 (released 2014-12-31) is discontinued since Mockito 2.x and incompatible with JUnit 5. Use the current versions:

🔧 Proposed fix
-    testImplementation("org.mockito:mockito-all:1.10.19")
+    testImplementation("org.mockito:mockito-core:5.21.0")
+    testImplementation("org.mockito:mockito-junit-jupiter:5.21.0")

For JUnit 5 tests, annotate with @ExtendWith(MockitoExtension.class).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
testImplementation("org.mockito:mockito-all:1.10.19")
testImplementation("org.mockito:mockito-core:5.21.0")
testImplementation("org.mockito:mockito-junit-jupiter:5.21.0")
🤖 Prompt for AI Agents
In `@build.gradle.kts` at line 36, Replace the deprecated dependency declaration
testImplementation("org.mockito:mockito-all:1.10.19") with the modern Mockito
artifacts for JUnit 5: add
testImplementation("org.mockito:mockito-core:<latest-version>") and
testImplementation("org.mockito:mockito-junit-jupiter:<latest-version>") in
build.gradle.kts, then update tests using Mockito to use the JUnit 5 extension
by annotating test classes with `@ExtendWith`(MockitoExtension.class) (or migrate
to `@Mock/`@InjectMocks with MockitoExtension) to ensure compatibility.

@carlspring carlspring force-pushed the issues/71-upgrade-jdk-gradle-dependencies branch from 486b3f8 to ee16ede Compare January 30, 2026 18:51
* Upgraded the GitHub actions.
* Upgraded the JDK to 22 or higher.
* Upgraded Gradle to newest possible 9.x.
* Upgraded Mockito.
* Upgraded JUnit.
@carlspring carlspring force-pushed the issues/71-upgrade-jdk-gradle-dependencies branch from ee16ede to 97ac86c Compare January 30, 2026 18:59
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.

Upgrade to a more recent JDK (21 or higher)

2 participants