diff --git a/.github/linters/sun_checks.xml b/.github/linters/sun_checks.xml index f596335..4d9f089 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"> - + - + - + - - + - + - + - + + Disabled online due to long lines--> - + - + @@ -90,18 +90,16 @@ - + - - - + @@ -114,7 +112,7 @@ - + @@ -126,22 +124,21 @@ - + - - + - + - + @@ -154,12 +151,12 @@ - + - + @@ -167,7 +164,7 @@ - + - + - + @@ -194,17 +191,19 @@ - + + - + - + - - - + + + \ No newline at end of file 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 diff --git a/src/test/java/io/tus/java/client/TestTusClient.java b/src/test/java/io/tus/java/client/TestTusClient.java index 4cfe140..9bd1ec5 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()); } /** @@ -248,9 +249,9 @@ 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) { - 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")); } }