From aa9a92636f13ee7948331854b9d5210d59590fd5 Mon Sep 17 00:00:00 2001 From: Rich Ellis Date: Mon, 30 Jun 2025 16:01:48 +0100 Subject: [PATCH 1/2] test: cleanup unnecessary boxing --- .../features/pagination/PaginationOperationTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/features/pagination/PaginationOperationTest.java b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/features/pagination/PaginationOperationTest.java index 162b3911d..2375bdae5 100644 --- a/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/features/pagination/PaginationOperationTest.java +++ b/modules/cloudant/src/test/java/com/ibm/cloud/cloudant/features/pagination/PaginationOperationTest.java @@ -218,7 +218,7 @@ Object[] makeTestCase(int total, int pageSize) { private Pagination makeTestPagination(int pageSize, Supplier> supplier) throws Exception { this.provider.setRequiredOpts(); - this.provider.set("limit", Integer.valueOf(pageSize).longValue()); + this.provider.set("limit", (long) pageSize); return makeNewPagination(new MockPagerCloudant(supplier), provider.build()); } @@ -235,7 +235,7 @@ private void runPaginationTest(TestCase t, private void runPaginationErrorTest(Function, PagingResult> pagingFunction, MockError error, boolean errorOnFirstPage) throws Exception { - int pageSize = Long.valueOf(OptionsHandler.MAX_LIMIT).intValue(); + int pageSize = OptionsHandler.MAX_LIMIT.intValue(); int wholePages = 2; int expectedItems = wholePages * pageSize; List> instructions = new ArrayList<>(); @@ -283,7 +283,7 @@ public void testValidationEnabled() throws Exception { Assert.assertThrows("There should be a validation exception", IllegalArgumentException.class, () -> { runPaginationTest( - new TestCase(0, Long.valueOf(OptionsHandler.MIN_LIMIT - 1).intValue(), plusOnePaging), + new TestCase(0, Math.toIntExact(OptionsHandler.MIN_LIMIT - 1), plusOnePaging), p -> null, Collections.emptyList()); }); } From 423a646a9db773bc626c490323b9e99bb9d8fe46 Mon Sep 17 00:00:00 2001 From: Rich Ellis Date: Mon, 30 Jun 2025 16:06:20 +0100 Subject: [PATCH 2/2] test: add break --- .../cloud/cloudant/internal/ErrorTransformInterceptorTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java b/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java index d8f267c8b..0bfbd1ad8 100644 --- a/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java +++ b/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java @@ -298,6 +298,7 @@ private enum Case { case BOTH: responseBuilder.header("x-couch-request-id", MOCK_COUCH_REQ_ID); responseBuilder.header("x-request-id", MOCK_REQ_ID); + break; case NONE: default: break;