Convert tests to JUnit 4 @Tests Change-Id: Ic0eb0bdb83fb998f35f4026ca0062a34a6b20bb0
diff --git a/gitiles-servlet/src/test/java/com/google/gitiles/LinkifierTest.java b/gitiles-servlet/src/test/java/com/google/gitiles/LinkifierTest.java index 84f5f4f..cfd2423 100644 --- a/gitiles-servlet/src/test/java/com/google/gitiles/LinkifierTest.java +++ b/gitiles-servlet/src/test/java/com/google/gitiles/LinkifierTest.java
@@ -14,28 +14,28 @@ package com.google.gitiles; -import javax.servlet.http.HttpServletRequest; - -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import org.junit.Test; + +import javax.servlet.http.HttpServletRequest; + /** Tests for {@link Linkifier}. */ -public class LinkifierTest extends TestCase { +public class LinkifierTest { private static final HttpServletRequest REQ = FakeHttpServletRequest.newRequest(); - @Override - protected void setUp() throws Exception { - } - - public void testlinkifyMessageNoMatch() throws Exception { + @Test + public void linkifyMessageNoMatch() throws Exception { Linkifier l = new Linkifier(TestGitilesUrls.URLS); assertEquals(ImmutableList.of(ImmutableMap.of("text", "some message text")), l.linkify(FakeHttpServletRequest.newRequest(), "some message text")); } - public void testlinkifyMessageUrl() throws Exception { + @Test + public void linkifyMessageUrl() throws Exception { Linkifier l = new Linkifier(TestGitilesUrls.URLS); assertEquals(ImmutableList.of( ImmutableMap.of("text", "http://my/url", "url", "http://my/url")), @@ -57,7 +57,8 @@ l.linkify(REQ, "foo http://my/url bar http://my/other/url baz")); } - public void testlinkifyMessageChangeIdNoGerrit() throws Exception { + @Test + public void linkifyMessageChangeIdNoGerrit() throws Exception { Linkifier l = new Linkifier(new GitilesUrls() { @Override public String getBaseGerritUrl(HttpServletRequest req) { @@ -82,7 +83,8 @@ l.linkify(REQ, "Change-Id: I0123456789 does not exist")); } - public void testlinkifyMessageChangeId() throws Exception { + @Test + public void linkifyMessageChangeId() throws Exception { Linkifier l = new Linkifier(TestGitilesUrls.URLS); assertEquals(ImmutableList.of( ImmutableMap.of("text", "I0123456789", @@ -101,7 +103,8 @@ l.linkify(REQ, "Change-Id: I0123456789 exists")); } - public void testlinkifyMessageUrlAndChangeId() throws Exception { + @Test + public void linkifyMessageUrlAndChangeId() throws Exception { Linkifier l = new Linkifier(TestGitilesUrls.URLS); assertEquals(ImmutableList.of( ImmutableMap.of("text", "http://my/url/I0123456789", "url", "http://my/url/I0123456789"), @@ -111,7 +114,8 @@ l.linkify(REQ, "http://my/url/I0123456789 is not change I0123456789")); } - public void testLinkifyAmpersand() throws Exception { + @Test + public void linkifyAmpersand() throws Exception { Linkifier l = new Linkifier(TestGitilesUrls.URLS); assertEquals(ImmutableList.of( ImmutableMap.of("text", "http://my/url?a&b", "url", "http://my/url?a&b")),