summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-09-29 14:39:56 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2019-06-19 10:43:01 +0200
commitf18b5010fcf750e6949e53dca292db9f2b4dc57d (patch)
treed3c7db6a7e4f5d6bbb48fae9e483545f52a7d761 /org.eclipse.jgit.test
parent9387288a8612eb9e9478c5ecfe4b1351a0ed4717 (diff)
downloadjgit-f18b5010fcf750e6949e53dca292db9f2b4dc57d.tar.gz
jgit-f18b5010fcf750e6949e53dca292db9f2b4dc57d.zip
Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8
Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java9
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java7
6 files changed, 18 insertions, 13 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java
index 347883f842..abf7d56819 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -72,7 +73,9 @@ public class MergeHeadMsgTest extends RepositoryTestCase {
// same test again, this time with lower-level io
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), "MERGE_HEAD"));) {
- fos.write("0000000000000000000000000000000000000000\n1c6db447abdbb291b25f07be38ea0b1bf94947c5\n".getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(
+ "0000000000000000000000000000000000000000\n1c6db447abdbb291b25f07be38ea0b1bf94947c5\n"
+ .getBytes(UTF_8));
}
assertEquals(db.readMergeHeads().size(), 2);
assertEquals(db.readMergeHeads().get(0), ObjectId.zeroId());
@@ -82,7 +85,7 @@ public class MergeHeadMsgTest extends RepositoryTestCase {
assertEquals(db.readMergeHeads(), null);
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), "MERGE_HEAD"))) {
- fos.write(sampleId.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(sampleId.getBytes(UTF_8));
}
assertEquals(db.readMergeHeads().size(), 1);
assertEquals(db.readMergeHeads().get(0), ObjectId.fromString(sampleId));
@@ -100,7 +103,7 @@ public class MergeHeadMsgTest extends RepositoryTestCase {
assertFalse(new File(db.getDirectory(), "MERGE_MSG").exists());
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), Constants.MERGE_MSG))) {
- fos.write(mergeMsg.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(mergeMsg.getBytes(UTF_8));
}
assertEquals(db.readMergeCommitMsg(), mergeMsg);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
index 3542dfad2d..bb24994ee8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.lib;
import static java.lang.Long.valueOf;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -181,7 +182,7 @@ public class RacyGitTests extends RepositoryTestCase {
private File addToWorkDir(String path, String content) throws IOException {
File f = new File(db.getWorkTree(), path);
try (FileOutputStream fos = new FileOutputStream(f)) {
- fos.write(content.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(content.getBytes(UTF_8));
return f;
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java
index 203c00e28a..f58ab06074 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -68,7 +69,7 @@ public class SquashCommitMsgTest extends RepositoryTestCase {
assertFalse(new File(db.getDirectory(), Constants.SQUASH_MSG).exists());
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), Constants.SQUASH_MSG))) {
- fos.write(squashMsg.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(squashMsg.getBytes(UTF_8));
}
assertEquals(db.readSquashCommitMsg(), squashMsg);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
index 5af62b6704..b131808318 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.merge;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
@@ -302,7 +303,7 @@ public class MergeAlgorithmTest {
T(commonBase), T(ours), T(theirs));
ByteArrayOutputStream bo=new ByteArrayOutputStream(50);
fmt.formatMerge(bo, r, "B", "O", "T", Constants.CHARACTER_ENCODING);
- return new String(bo.toByteArray(), Constants.CHARACTER_ENCODING);
+ return new String(bo.toByteArray(), UTF_8);
}
public String t(String text) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java
index 391a701b8e..ad8ae42536 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -50,7 +51,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import org.eclipse.jgit.lib.Constants;
import org.junit.Before;
import org.junit.Test;
@@ -173,8 +173,8 @@ public class PacketLineOutTest {
assertEquals(1, flushCnt[0]);
}
- private void assertBuffer(String exp) throws IOException {
+ private void assertBuffer(String exp) {
assertEquals(exp, new String(rawOut.toByteArray(),
- Constants.CHARACTER_ENCODING));
+ UTF_8));
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
index 4d3e162240..b6cf3564c1 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.transport;
import static java.lang.Integer.valueOf;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_DATA;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_ERROR;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_PROGRESS;
@@ -59,7 +60,6 @@ import java.io.OutputStream;
import java.text.MessageFormat;
import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.Constants;
import org.junit.Before;
import org.junit.Test;
@@ -259,8 +259,7 @@ public class SideBandOutputStreamTest {
}
}
- private void assertBuffer(String exp) throws IOException {
- assertEquals(exp, new String(rawOut.toByteArray(),
- Constants.CHARACTER_ENCODING));
+ private void assertBuffer(String exp) {
+ assertEquals(exp, new String(rawOut.toByteArray(), UTF_8));
}
}