From 7e49c5a63dc4c1755a9b4d03a6a736c64b0a56a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 01:22:54 +0000 Subject: [PATCH 1/5] Bump github/super-linter from 5 to 6 Bumps [github/super-linter](https://github.com/github/super-linter) from 5 to 6. - [Release notes](https://github.com/github/super-linter/releases) - [Changelog](https://github.com/github/super-linter/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/super-linter/compare/v5...v6) --- updated-dependencies: - dependency-name: github/super-linter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/lintChanges.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lintChanges.yml b/.github/workflows/lintChanges.yml index 129960c..7c402c1 100644 --- a/.github/workflows/lintChanges.yml +++ b/.github/workflows/lintChanges.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 0 - name: Lint_Java - uses: github/super-linter@v5 + uses: github/super-linter@v6 env: VALIDATE_ALL_CODEBASE: true # lint all files VALIDATE_JAVA: true # only lint Java files From fd21fb28926ec842627f5070c7a7396eecf77ffa Mon Sep 17 00:00:00 2001 From: florian <60937022+cdr-chakotay@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:33:45 +0200 Subject: [PATCH 2/5] Simplified test. Reviewed Rules for linter error. --- .../io/tus/java/client/TestTusClient.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/test/java/io/tus/java/client/TestTusClient.java b/src/test/java/io/tus/java/client/TestTusClient.java index 4cfe140..4d2e5be 100644 --- a/src/test/java/io/tus/java/client/TestTusClient.java +++ b/src/test/java/io/tus/java/client/TestTusClient.java @@ -1,10 +1,5 @@ package io.tus.java.client; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.HttpURLConnection; @@ -21,6 +16,12 @@ import org.mockserver.model.HttpRequest; import org.mockserver.model.HttpResponse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + /** * Class to test the tus-Client. */ @@ -32,7 +33,7 @@ public class TestTusClient extends MockServerProvider { @Test public void testTusClient() { TusClient client = new TusClient(); - assertEquals(client.getUploadCreationURL(), null); + assertNull(client.getUploadCreationURL()); } /** @@ -63,14 +64,14 @@ public void testSetUploadCreationURL() throws MalformedURLException { @Test public void testEnableResuming() { TusClient client = new TusClient(); - assertEquals(client.resumingEnabled(), false); + assertFalse(client.resumingEnabled()); TusURLStore store = new TusURLMemoryStore(); client.enableResuming(store); - assertEquals(client.resumingEnabled(), true); + assertTrue(client.resumingEnabled()); client.disableResuming(); - assertEquals(client.resumingEnabled(), false); + assertFalse(client.resumingEnabled()); } /** @@ -250,7 +251,7 @@ public void testResumeUpload() throws ResumingNotEnabledException, FingerprintNo */ private class TestResumeUploadStore implements TusURLStore { public void set(String fingerprint, URL url) { - assertTrue("set method must not be called", false); + fail("set method must not be called"); } public URL get(String fingerprint) { @@ -258,12 +259,12 @@ public URL get(String fingerprint) { try { return new URL(mockServerURL.toString() + "/foo"); - } catch (Exception e) { } + } catch (Exception ignored) { } return null; } public void remove(String fingerprint) { - assertTrue("remove method must not be called", false); + fail("remove method must not be called"); } } @@ -513,14 +514,14 @@ public void testRemoveFingerprintOnSuccessDisabled() throws IOException, Protoco store.set("fingerprint", dummyURL); client.enableResuming(store); - assertTrue(!client.removeFingerprintOnSuccessEnabled()); + assertFalse(client.removeFingerprintOnSuccessEnabled()); TusUpload upload = new TusUpload(); upload.setFingerprint("fingerprint"); client.uploadFinished(upload); - assertTrue(dummyURL.equals(store.get("fingerprint"))); + assertEquals(dummyURL, store.get("fingerprint")); } @@ -548,7 +549,7 @@ public void testRemoveFingerprintOnSuccessEnabled() throws IOException, Protocol client.uploadFinished(upload); - assertTrue(store.get("fingerprint") == null); + assertNull(store.get("fingerprint")); } } From f9af6d94dc68318353a0330bbf9101e73d9142a8 Mon Sep 17 00:00:00 2001 From: florian <60937022+cdr-chakotay@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:48:10 +0200 Subject: [PATCH 3/5] Update Linter Settings --- .github/linters/sun_checks.xml | 70 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/.github/linters/sun_checks.xml b/.github/linters/sun_checks.xml index f596335..81a826d 100644 --- a/.github/linters/sun_checks.xml +++ b/.github/linters/sun_checks.xml @@ -1,7 +1,7 @@ + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "https://checkstyle.org/dtds/configuration_1_3.dtd"> - + - + - + - - + - + - + - + - + - + - + @@ -90,18 +89,16 @@ - + - - - + @@ -114,7 +111,7 @@ - + @@ -126,22 +123,21 @@ - + - - + - + - + @@ -154,12 +150,12 @@ - + - + @@ -167,7 +163,7 @@ - + - + - + @@ -194,17 +190,19 @@ - + + - + - + - - - + + + \ No newline at end of file From 34f92ebdaaea5e0155bdf7ed2480575a87dde265 Mon Sep 17 00:00:00 2001 From: florian <60937022+cdr-chakotay@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:52:13 +0200 Subject: [PATCH 4/5] Set final modifier in order to satisfy the linter and because it also makes sense there. --- src/test/java/io/tus/java/client/TestTusClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/io/tus/java/client/TestTusClient.java b/src/test/java/io/tus/java/client/TestTusClient.java index 4d2e5be..9bd1ec5 100644 --- a/src/test/java/io/tus/java/client/TestTusClient.java +++ b/src/test/java/io/tus/java/client/TestTusClient.java @@ -249,7 +249,7 @@ public void testResumeUpload() throws ResumingNotEnabledException, FingerprintNo /** * Test Implementation for a {@link TusURLStore}. */ - private class TestResumeUploadStore implements TusURLStore { + private final class TestResumeUploadStore implements TusURLStore { public void set(String fingerprint, URL url) { fail("set method must not be called"); } From 984788145b908302d83a5a2987fd5c0a57c51e71 Mon Sep 17 00:00:00 2001 From: florian <60937022+cdr-chakotay@users.noreply.github.com> Date: Wed, 5 Jun 2024 20:52:13 +0200 Subject: [PATCH 5/5] Set final modifier in order to satisfy the linter and because it also makes sense there. --- .github/linters/sun_checks.xml | 9 +++++---- src/test/java/io/tus/java/client/TestTusClient.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/linters/sun_checks.xml b/.github/linters/sun_checks.xml index 81a826d..4d9f089 100644 --- a/.github/linters/sun_checks.xml +++ b/.github/linters/sun_checks.xml @@ -71,9 +71,10 @@ - + @@ -172,7 +173,7 @@ Disabled online due to constructors--> - + @@ -192,7 +193,7 @@ - + diff --git a/src/test/java/io/tus/java/client/TestTusClient.java b/src/test/java/io/tus/java/client/TestTusClient.java index 4d2e5be..9bd1ec5 100644 --- a/src/test/java/io/tus/java/client/TestTusClient.java +++ b/src/test/java/io/tus/java/client/TestTusClient.java @@ -249,7 +249,7 @@ public void testResumeUpload() throws ResumingNotEnabledException, FingerprintNo /** * Test Implementation for a {@link TusURLStore}. */ - private class TestResumeUploadStore implements TusURLStore { + private final class TestResumeUploadStore implements TusURLStore { public void set(String fingerprint, URL url) { fail("set method must not be called"); }