From 58b999adfef7a47c9d580f2e78bb3d61ca90ad28 Mon Sep 17 00:00:00 2001 From: skyflow-himanshu Date: Mon, 9 Feb 2026 18:40:14 +0530 Subject: [PATCH 1/3] SK-2527: update libraries for Java v2 SDK --- pom.xml | 16 +++++----------- .../java/com/skyflow/utils/HttpUtilityTests.java | 10 ++-------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 7c7121b5..3d7483f6 100644 --- a/pom.xml +++ b/pom.xml @@ -126,15 +126,9 @@ - org.powermock - powermock-module-junit4 - 2.0.9 - test - - - org.powermock - powermock-api-mockito2 - 2.0.9 + org.mockito + mockito-inline + 4.11.0 test @@ -215,7 +209,7 @@ org.jacoco jacoco-maven-plugin - 0.8.7 + 0.8.14 prepare-agent @@ -301,7 +295,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.4.0 + 0.10.0 true central diff --git a/src/test/java/com/skyflow/utils/HttpUtilityTests.java b/src/test/java/com/skyflow/utils/HttpUtilityTests.java index f7214690..8456706c 100644 --- a/src/test/java/com/skyflow/utils/HttpUtilityTests.java +++ b/src/test/java/com/skyflow/utils/HttpUtilityTests.java @@ -9,8 +9,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -26,8 +25,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; -@RunWith(PowerMockRunner.class) -@PrepareForTest({URL.class, HttpURLConnection.class}) +@RunWith(MockitoJUnitRunner.class) public class HttpUtilityTests { private static String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; @@ -60,7 +58,6 @@ protected URLConnection openConnection(final URL arg0) throws IOException { } @Test - @PrepareForTest({URL.class, HttpURLConnection.class}) public void testSendRequest() { try { given(mockConnection.getRequestProperty("content-type")).willReturn("application/json"); @@ -77,7 +74,6 @@ public void testSendRequest() { @Test - @PrepareForTest({URL.class, HttpURLConnection.class}) public void testSendRequestFormData() { try { given(mockConnection.getRequestProperty("content-type")).willReturn("multipart/form-data"); @@ -93,7 +89,6 @@ public void testSendRequestFormData() { } @Test - @PrepareForTest({URL.class, HttpURLConnection.class}) public void testSendRequestFormURLEncoded() { try { given(mockConnection.getRequestProperty("content-type")).willReturn("application/x-www-form-urlencoded"); @@ -109,7 +104,6 @@ public void testSendRequestFormURLEncoded() { } @Test - @PrepareForTest({URL.class, HttpURLConnection.class}) public void testSendRequestError() { try { given(mockConnection.getResponseCode()).willReturn(500); From 68b5366d71bd39eeb97c8b093b41bb844305105c Mon Sep 17 00:00:00 2001 From: skyflow-himanshu Date: Mon, 9 Feb 2026 19:18:16 +0530 Subject: [PATCH 2/3] SK-2527: update libraries from mockito-inline to mockito-core to fix ci test failures --- pom.xml | 2 +- src/test/java/com/skyflow/utils/HttpUtilityTests.java | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 3d7483f6..48bdd2eb 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ org.mockito - mockito-inline + mockito-core 4.11.0 test diff --git a/src/test/java/com/skyflow/utils/HttpUtilityTests.java b/src/test/java/com/skyflow/utils/HttpUtilityTests.java index 8456706c..f695fb2a 100644 --- a/src/test/java/com/skyflow/utils/HttpUtilityTests.java +++ b/src/test/java/com/skyflow/utils/HttpUtilityTests.java @@ -29,8 +29,6 @@ public class HttpUtilityTests { private static String INVALID_EXCEPTION_THROWN = "Should not have thrown any exception"; - @InjectMocks - HttpUtility httpUtility; @Mock OutputStream outputStream; private String expected; @@ -65,7 +63,7 @@ public void testSendRequest() { headers.put("content-type", "application/json"); JsonObject params = new JsonObject(); params.addProperty("key", "value"); - String response = httpUtility.sendRequest("GET", url, params, headers); + String response = HttpUtility.sendRequest("GET", url, params, headers); Assert.assertEquals(expected, response); } catch (Exception e) { fail(INVALID_EXCEPTION_THROWN); @@ -81,7 +79,7 @@ public void testSendRequestFormData() { headers.put("content-type", "multipart/form-data"); JsonObject params = new JsonObject(); params.addProperty("key", "value"); - String response = httpUtility.sendRequest("GET", url, params, headers); + String response = HttpUtility.sendRequest("GET", url, params, headers); Assert.assertEquals(expected, response); } catch (Exception e) { fail(INVALID_EXCEPTION_THROWN); @@ -96,7 +94,7 @@ public void testSendRequestFormURLEncoded() { headers.put("content-type", "application/x-www-form-urlencoded"); JsonObject params = new JsonObject(); params.addProperty("key", "value"); - String response = httpUtility.sendRequest("GET", url, params, headers); + String response = HttpUtility.sendRequest("GET", url, params, headers); Assert.assertEquals(expected, response); } catch (Exception e) { fail(INVALID_EXCEPTION_THROWN); @@ -107,7 +105,7 @@ public void testSendRequestFormURLEncoded() { public void testSendRequestError() { try { given(mockConnection.getResponseCode()).willReturn(500); - String response = httpUtility.sendRequest("GET", url, null, null); + String response = HttpUtility.sendRequest("GET", url, null, null); } catch (SkyflowException e) { Assert.assertEquals(500, e.getHttpCode()); Assert.assertEquals(new Integer(123), e.getGrpcCode()); From b2a720b3eed66797bae34f9c4beae80fa556acf7 Mon Sep 17 00:00:00 2001 From: skyflow-himanshu Date: Wed, 11 Feb 2026 11:49:28 +0530 Subject: [PATCH 3/3] SK-2527: addressed copilot suggestions --- src/test/java/com/skyflow/utils/HttpUtilityTests.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/com/skyflow/utils/HttpUtilityTests.java b/src/test/java/com/skyflow/utils/HttpUtilityTests.java index f695fb2a..c9595bb7 100644 --- a/src/test/java/com/skyflow/utils/HttpUtilityTests.java +++ b/src/test/java/com/skyflow/utils/HttpUtilityTests.java @@ -6,7 +6,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner;