aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2010-12-31 11:44:54 +0100
committerShawn O. Pearce <spearce@spearce.org>2010-12-31 14:00:05 -0800
commitd9e07a574a946693e491668e0d94619bc5d886a5 (patch)
tree5bce4e9d47090d6b427986de4db30be17cc99c6d /org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
parent7cf8b8812f7baa1636c138113f4ed015eed8cc31 (diff)
downloadjgit-d9e07a574a946693e491668e0d94619bc5d886a5.tar.gz
jgit-d9e07a574a946693e491668e0d94619bc5d886a5.zip
Convert all JGit unit tests to JUnit 4
Eclipse has some problem re-running single JUnit tests if the tests are in Junit 3 format, but the JUnit 4 launcher is used. This was quite unnecessary and the move was not completed. We still have no JUnit4 test. This completes the extermination of JUnit3. Most of the work was global searce/replace using regular expression, followed by numerous invocarions of quick-fix and organize imports and verification that we had the same number of tests before and after. - Annotations were introduced. - All references to JUnit3 classes removed - Half-good replacement for getting the test name. This was needed to make the TestRngs work. The initialization of TestRngs was also made lazily since we can not longer find out the test name in runtime in the @Before methods. - Renamed test classes to end with Test, with the exception of TestTranslateBundle, which fails from Maven - Moved JGitTestUtil to the junit support bundle Change-Id: Iddcd3da6ca927a7be773a9c63ebf8bb2147e2d13 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
index 8d06987fde..2aaf6afbe3 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/patch/GetTextTest.java
@@ -43,14 +43,20 @@
package org.eclipse.jgit.patch;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
-import junit.framework.TestCase;
+import org.eclipse.jgit.junit.JGitTestUtil;
+import org.junit.Test;
-public class GetTextTest extends TestCase {
+public class GetTextTest {
+ @Test
public void testGetText_BothISO88591() throws IOException {
final Charset cs = Charset.forName("ISO-8859-1");
final Patch p = parseTestPatchFile();
@@ -61,6 +67,7 @@ public class GetTextTest extends TestCase {
assertEquals(readTestPatchFile(cs), fh.getScriptText(cs, cs));
}
+ @Test
public void testGetText_NoBinary() throws IOException {
final Charset cs = Charset.forName("ISO-8859-1");
final Patch p = parseTestPatchFile();
@@ -71,6 +78,7 @@ public class GetTextTest extends TestCase {
assertEquals(readTestPatchFile(cs), fh.getScriptText(cs, cs));
}
+ @Test
public void testGetText_Convert() throws IOException {
final Charset csOld = Charset.forName("ISO-8859-1");
final Charset csNew = Charset.forName("UTF-8");
@@ -90,6 +98,7 @@ public class GetTextTest extends TestCase {
assertEquals(exp, fh.getScriptText(csOld, csNew));
}
+ @Test
public void testGetText_DiffCc() throws IOException {
final Charset csOld = Charset.forName("ISO-8859-1");
final Charset csNew = Charset.forName("UTF-8");
@@ -111,7 +120,7 @@ public class GetTextTest extends TestCase {
}
private Patch parseTestPatchFile() throws IOException {
- final String patchFile = getName() + ".patch";
+ final String patchFile = JGitTestUtil.getName() + ".patch";
final InputStream in = getClass().getResourceAsStream(patchFile);
if (in == null) {
fail("No " + patchFile + " test vector");
@@ -127,7 +136,7 @@ public class GetTextTest extends TestCase {
}
private String readTestPatchFile(final Charset cs) throws IOException {
- final String patchFile = getName() + ".patch";
+ final String patchFile = JGitTestUtil.getName() + ".patch";
final InputStream in = getClass().getResourceAsStream(patchFile);
if (in == null) {
fail("No " + patchFile + " test vector");