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.junit.http | |
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.junit.http')
4 files changed, 16 insertions, 13 deletions
diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF index f240f1ffb1..1c28dd112d 100644 --- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF @@ -9,7 +9,6 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Import-Package: javax.servlet;version="[2.5.0,3.0.0)", javax.servlet.http;version="[2.5.0,3.0.0)", - junit.framework;version="[3.8.2,4.0.0)", org.eclipse.jetty.continuation;version="[7.1.0,8.0.0)", org.eclipse.jetty.http;version="[7.1.0,8.0.0)", org.eclipse.jetty.http.security;version="[7.1.0,8.0.0)", @@ -30,5 +29,6 @@ Import-Package: javax.servlet;version="[2.5.0,3.0.0)", org.eclipse.jgit.lib;version="[0.11.0,0.12.0)", org.eclipse.jgit.revwalk;version="[0.11.0,0.12.0)", org.eclipse.jgit.storage.file;version="[0.11.0,0.12.0)", - org.eclipse.jgit.transport;version="[0.11.0,0.12.0)" + org.eclipse.jgit.transport;version="[0.11.0,0.12.0)", + org.junit;version="[4.0.0,5.0.0)" Export-Package: org.eclipse.jgit.junit.http;version="0.11.0" diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java index 2d1c98c911..1e7a6e79aa 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java @@ -43,6 +43,9 @@ package org.eclipse.jgit.junit.http; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import java.net.InetAddress; import java.net.URI; @@ -51,8 +54,6 @@ import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; -import junit.framework.Assert; - import org.eclipse.jetty.http.security.Constraint; import org.eclipse.jetty.http.security.Password; import org.eclipse.jetty.security.Authenticator; @@ -282,10 +283,10 @@ public class AppServer { } private void assertNotYetSetUp() { - Assert.assertFalse("server is not running", server.isRunning()); + assertFalse("server is not running", server.isRunning()); } private void assertAlreadySetUp() { - Assert.assertTrue("server is running", server.isRunning()); + assertTrue("server is running", server.isRunning()); } } diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java index 7da903461d..56d05c60c0 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java @@ -43,6 +43,8 @@ package org.eclipse.jgit.junit.http; +import static org.junit.Assert.fail; + import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -73,12 +75,12 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase { /** In-memory application server; subclass must start. */ protected AppServer server; - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); server = new AppServer(); } - protected void tearDown() throws Exception { + public void tearDown() throws Exception { server.tearDown(); super.tearDown(); } diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java index b186e1f248..f71bc9350f 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java @@ -43,11 +43,6 @@ package org.eclipse.jgit.junit.http; -import org.eclipse.jetty.server.DispatcherType; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Response; -import org.eclipse.jetty.server.handler.HandlerWrapper; - import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -57,6 +52,11 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.eclipse.jetty.server.DispatcherType; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Response; +import org.eclipse.jetty.server.handler.HandlerWrapper; + /** Logs request made through {@link AppServer}. */ class TestRequestLog extends HandlerWrapper { private static final int MAX = 16; |