package org.eclipse.jgit.patch;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class GetTextTest {
@Test
public void testGetText_BothISO88591() throws IOException {
- final Charset cs = Charset.forName("ISO-8859-1");
+ final Charset cs = ISO_8859_1;
final Patch p = parseTestPatchFile();
assertTrue(p.getErrors().isEmpty());
assertEquals(1, p.getFiles().size());
@Test
public void testGetText_NoBinary() throws IOException {
- final Charset cs = Charset.forName("ISO-8859-1");
+ final Charset cs = ISO_8859_1;
final Patch p = parseTestPatchFile();
assertTrue(p.getErrors().isEmpty());
assertEquals(1, p.getFiles().size());
@Test
public void testGetText_Convert() throws IOException {
- final Charset csOld = Charset.forName("ISO-8859-1");
- final Charset csNew = Charset.forName("UTF-8");
+ final Charset csOld = ISO_8859_1;
+ final Charset csNew = UTF_8;
final Patch p = parseTestPatchFile();
assertTrue(p.getErrors().isEmpty());
assertEquals(1, p.getFiles().size());
@Test
public void testGetText_DiffCc() throws IOException {
- final Charset csOld = Charset.forName("ISO-8859-1");
- final Charset csNew = Charset.forName("UTF-8");
+ final Charset csOld = ISO_8859_1;
+ final Charset csNew = UTF_8;
final Patch p = parseTestPatchFile();
assertTrue(p.getErrors().isEmpty());
assertEquals(1, p.getFiles().size());