aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit/src
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.junit/src')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java6
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java3
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java3
3 files changed, 8 insertions, 4 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
index 4ba2606fb3..782d402f92 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/JGitTestUtil.java
@@ -45,6 +45,8 @@
package org.eclipse.jgit.junit;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -250,7 +252,7 @@ public abstract class JGitTestUtil {
public static void write(final File f, final String body)
throws IOException {
FileUtils.mkdirs(f.getParentFile(), true);
- Writer w = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
+ Writer w = new OutputStreamWriter(new FileOutputStream(f), UTF_8);
try {
w.write(body);
} finally {
@@ -270,7 +272,7 @@ public abstract class JGitTestUtil {
*/
public static String read(final File file) throws IOException {
final byte[] body = IO.readFully(file);
- return new String(body, 0, body.length, "UTF-8");
+ return new String(body, 0, body.length, UTF_8);
}
/**
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
index 9dac11e5bc..568bc3b0e1 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
@@ -45,6 +45,7 @@
package org.eclipse.jgit.junit;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
@@ -351,7 +352,7 @@ public abstract class LocalDiskRepositoryTestCase {
if (0 != (includedOptions & CONTENT)) {
sb.append(", content:"
+ new String(repo.open(entry.getObjectId(),
- Constants.OBJ_BLOB).getCachedBytes(), "UTF-8"));
+ Constants.OBJ_BLOB).getCachedBytes(), UTF_8));
}
if (0 != (includedOptions & ASSUME_UNCHANGED))
sb.append(", assume-unchanged:"
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
index 8f44620b80..afc2c445cf 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepositoryTestCase.java
@@ -46,6 +46,7 @@
package org.eclipse.jgit.junit;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.File;
@@ -198,7 +199,7 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
protected static void checkFile(File f, final String checkData)
throws IOException {
try (Reader r = new InputStreamReader(new FileInputStream(f),
- "UTF-8")) {
+ UTF_8)) {
if (checkData.length() > 0) {
char[] data = new char[checkData.length()];
assertEquals(data.length, r.read(data));