diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2010-12-31 11:44:54 +0100 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-12-31 14:00:05 -0800 |
commit | d9e07a574a946693e491668e0d94619bc5d886a5 (patch) | |
tree | 5bce4e9d47090d6b427986de4db30be17cc99c6d /org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java | |
parent | 7cf8b8812f7baa1636c138113f4ed015eed8cc31 (diff) | |
download | jgit-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/api/AddCommandTest.java')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java index 556fc12086..33f305d487 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java @@ -43,6 +43,9 @@ */ package org.eclipse.jgit.api; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -58,9 +61,11 @@ import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.RepositoryTestCase; import org.eclipse.jgit.util.FileUtils; +import org.junit.Test; public class AddCommandTest extends RepositoryTestCase { + @Test public void testAddNothing() { Git git = new Git(db); @@ -73,6 +78,7 @@ public class AddCommandTest extends RepositoryTestCase { } + @Test public void testAddNonExistingSingleFile() throws NoFilepatternException { Git git = new Git(db); @@ -81,6 +87,7 @@ public class AddCommandTest extends RepositoryTestCase { } + @Test public void testAddExistingSingleFile() throws IOException, NoFilepatternException { File file = new File(db.getWorkTree(), "a.txt"); file.createNewFile(); @@ -97,6 +104,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddExistingSingleFileInSubDir() throws IOException, NoFilepatternException { new File(db.getWorkTree(), "sub").mkdir(); File file = new File(db.getWorkTree(), "sub/a.txt"); @@ -114,6 +122,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddExistingSingleFileTwice() throws IOException, NoFilepatternException { File file = new File(db.getWorkTree(), "a.txt"); file.createNewFile(); @@ -137,6 +146,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddExistingSingleFileTwiceWithCommit() throws Exception { File file = new File(db.getWorkTree(), "a.txt"); file.createNewFile(); @@ -162,6 +172,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddRemovedFile() throws Exception { File file = new File(db.getWorkTree(), "a.txt"); file.createNewFile(); @@ -183,6 +194,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddRemovedCommittedFile() throws Exception { File file = new File(db.getWorkTree(), "a.txt"); file.createNewFile(); @@ -206,6 +218,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddWithConflicts() throws Exception { // prepare conflict @@ -259,6 +272,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddTwoFiles() throws Exception { File file = new File(db.getWorkTree(), "a.txt"); file.createNewFile(); @@ -280,6 +294,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddFolder() throws Exception { new File(db.getWorkTree(), "sub").mkdir(); File file = new File(db.getWorkTree(), "sub/a.txt"); @@ -302,6 +317,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddIgnoredFile() throws Exception { new File(db.getWorkTree(), "sub").mkdir(); File file = new File(db.getWorkTree(), "sub/a.txt"); @@ -330,6 +346,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAddWholeRepo() throws Exception { new File(db.getWorkTree(), "sub").mkdir(); File file = new File(db.getWorkTree(), "sub/a.txt"); @@ -356,6 +373,7 @@ public class AddCommandTest extends RepositoryTestCase { // file a exists in workdir and in index -> added // file b exists not in workdir but in index -> unchanged // file c exists in workdir but not in index -> added + @Test public void testAddWithoutParameterUpdate() throws Exception { new File(db.getWorkTree(), "sub").mkdir(); File file = new File(db.getWorkTree(), "sub/a.txt"); @@ -409,6 +427,7 @@ public class AddCommandTest extends RepositoryTestCase { // file a exists in workdir and in index -> added // file b exists not in workdir but in index -> deleted // file c exists in workdir but not in index -> unchanged + @Test public void testAddWithParameterUpdate() throws Exception { new File(db.getWorkTree(), "sub").mkdir(); File file = new File(db.getWorkTree(), "sub/a.txt"); @@ -457,6 +476,7 @@ public class AddCommandTest extends RepositoryTestCase { indexState(CONTENT)); } + @Test public void testAssumeUnchanged() throws Exception { Git git = new Git(db); String path = "a.txt"; |