summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.test/tst
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2017-12-07 10:23:38 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2017-12-07 20:02:59 +0900
commit171f84a04117cfd02446f67565073a05128777a4 (patch)
treede60805128113634bc7d92cce426db59a0a96b52 /org.eclipse.jgit.lfs.test/tst
parent5f94e4430800f6e1352733a3ff684e959341984d (diff)
downloadjgit-171f84a04117cfd02446f67565073a05128777a4.tar.gz
jgit-171f84a04117cfd02446f67565073a05128777a4.zip
Use constants from StandardCharsets instead of hard-coded strings
Instead of hard-coding the charset strings "US-ASCII", "UTF-8", and "ISO-8859-1", use the corresponding constants from StandardCharsets. UnsupportedEncodingException is not thrown when the StandardCharset constants are used, so remove the now redundant handling. Because the encoding names are no longer hard-coded strings, also remove redundant $NON-NLS warning suppressions. Also replace existing usages of the constants with static imports. Change-Id: I0a4510d3d992db5e277f009a41434276f95bda4e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.test/tst')
-rw-r--r--org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java4
-rw-r--r--org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
index 4827d3d113..2ace2e3ce6 100644
--- a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
+++ b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
@@ -43,11 +43,11 @@
package org.eclipse.jgit.lfs.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import org.eclipse.jgit.lfs.LfsPointer;
import org.junit.Test;
@@ -66,6 +66,6 @@ public class LFSPointerTest {
baos.close();
assertEquals("version https://git-lfs.github.com/spec/v1\noid sha256:"
+ s + "\nsize 4\n",
- baos.toString(StandardCharsets.UTF_8.name()));
+ baos.toString(UTF_8.name()));
}
}
diff --git a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java
index 31ab783e2a..d6dd3aa607 100644
--- a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java
+++ b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LongObjectIdTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.lfs.lib;
+import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -54,7 +55,6 @@ import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Locale;
@@ -270,7 +270,7 @@ public class LongObjectIdTest {
public void testCopyFromStringByte() {
AnyLongObjectId id1 = LongObjectIdTestUtils.hash("test");
byte[] buf = new byte[64];
- Charset cs = StandardCharsets.US_ASCII;
+ Charset cs = US_ASCII;
cs.encode(id1.name()).get(buf);
AnyLongObjectId id2 = LongObjectId.fromString(buf, 0);
assertEquals("objects should be equals", id1, id2);