You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2011/11/11 09:38:55 UTC

svn commit: r1200763 - /wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java

Author: mgrigorov
Date: Fri Nov 11 08:38:55 2011
New Revision: 1200763

URL: http://svn.apache.org/viewvc?rev=1200763&view=rev
Log:
WICKET-3979 Upgrade Wicket's tests to JUnit4


Modified:
    wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java

Modified: wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java?rev=1200763&r1=1200762&r2=1200763&view=diff
==============================================================================
--- wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java (original)
+++ wicket/trunk/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java Fri Nov 11 08:38:55 2011
@@ -25,9 +25,9 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.wicket.request.Url.QueryParameter;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * @author Matej Knopp
@@ -35,9 +35,7 @@ import org.apache.wicket.request.Url.Que
  */
 
 // TODO test removeleadingsegments,prependleadingsegments
-// TODO move this test to wicket-request where class Url is located
-// (once the dependency to WicketObjects is replaced)
-public class UrlTest extends TestCase
+public class UrlTest extends Assert
 {
 	private void checkSegments(Url url, String... segments)
 	{
@@ -59,6 +57,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse1()
 	{
 		String s = "foo/bar/baz?a=4&b=5";
@@ -70,6 +69,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse2()
 	{
 		String s = "foo/bar//baz?=4&6";
@@ -81,6 +81,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse3()
 	{
 		String s = "//foo/bar/";
@@ -92,6 +93,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse4()
 	{
 		String s = "/foo/bar//";
@@ -103,6 +105,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse5()
 	{
 		String s = "foo/b%3Dr/b%26z/x%3F?a=b&x%3F%264=y%3Dz";
@@ -114,6 +117,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse6()
 	{
 		String s = "";
@@ -125,6 +129,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse7()
 	{
 		String s = "?a=b";
@@ -136,6 +141,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse8()
 	{
 		String s = "/";
@@ -147,6 +153,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testParse9()
 	{
 		String s = "/?a=b";
@@ -158,6 +165,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testRender1()
 	{
 		Url url = new Url();
@@ -174,6 +182,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testRender2()
 	{
 		String s = "/absolute/url";
@@ -184,6 +193,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testRender3()
 	{
 		String s = "//absolute/url";
@@ -194,6 +204,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testRender4()
 	{
 		String s = "/";
@@ -204,6 +215,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testAbsolute1()
 	{
 		Url url = Url.parse("abc/efg");
@@ -213,6 +225,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testAbsolute2()
 	{
 		Url url = Url.parse("");
@@ -222,6 +235,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testAbsolute3()
 	{
 		Url url = Url.parse("/");
@@ -231,6 +245,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testAbsolute4()
 	{
 		Url url = Url.parse("/abc/efg");
@@ -240,6 +255,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat1()
 	{
 		Url url = Url.parse("abc/efg");
@@ -250,6 +266,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat2()
 	{
 		Url url = Url.parse("abc/efg");
@@ -260,6 +277,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat3()
 	{
 		Url url = Url.parse("abc/efg");
@@ -270,6 +288,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat4()
 	{
 		Url url = Url.parse("abc/efg");
@@ -280,6 +299,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat5()
 	{
 		Url url = Url.parse("abc/efg/");
@@ -290,6 +310,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat6()
 	{
 		Url url = Url.parse("abc/efg/");
@@ -300,6 +321,7 @@ public class UrlTest extends TestCase
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat7()
 	{
 		Url url = Url.parse("abc/efg/");
@@ -307,10 +329,10 @@ public class UrlTest extends TestCase
 		assertEquals(Url.parse(""), url);
 	}
 
-
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat8()
 	{
 		Url url = Url.parse("fff/abc/efg/xxx");
@@ -318,10 +340,10 @@ public class UrlTest extends TestCase
 		assertEquals(Url.parse("fff/abc/"), url);
 	}
 
-
 	/**
 	 * 
 	 */
+	@Test
 	public void testConcat9()
 	{
 		Url url = Url.parse("fff/abc/efg/xxx");
@@ -332,6 +354,7 @@ public class UrlTest extends TestCase
 	/**
 	 * @see <a href="https://issues.apache.org/jira/browse/WICKET-3363">WICKET-3363</a>
 	 */
+	@Test
 	public void testResolveRelative1()
 	{
 		Url relative = Url.parse("./a/b?p1=v1");
@@ -344,6 +367,7 @@ public class UrlTest extends TestCase
 	/**
 	 * @see <a href="https://issues.apache.org/jira/browse/WICKET-3363">WICKET-3363</a>
 	 */
+	@Test
 	public void testResolveRelative2()
 	{
 		Url relative = Url.parse("a/b?p1=v1");
@@ -356,6 +380,7 @@ public class UrlTest extends TestCase
 	/**
 	 * @see <a href="https://issues.apache.org/jira/browse/WICKET-3363">WICKET-3363</a>
 	 */
+	@Test
 	public void testResolveRelative3()
 	{
 		Url relative = Url.parse("../a/b?p1=v1");
@@ -368,6 +393,7 @@ public class UrlTest extends TestCase
 	/**
 	 * Tries to resolve a relative url against a base that has no segments
 	 */
+	@Test
 	public void testResolveRelative_NoSegmentsInBase()
 	{
 		Url relative = Url.parse("?a=b");
@@ -380,6 +406,7 @@ public class UrlTest extends TestCase
 	/**
 	 * Tries to resolve a relative url against a base that has no segments
 	 */
+	@Test
 	public void testResolveRelative_NoSegmentsInBase2()
 	{
 		Url relative = Url.parse("bar/baz?a=b");
@@ -392,6 +419,7 @@ public class UrlTest extends TestCase
 	/**
 	 * Tests that the default charset is UTF-8
 	 */
+	@Test
 	public void testCharset1()
 	{
 		Url url = new Url();
@@ -401,6 +429,7 @@ public class UrlTest extends TestCase
 	/**
 	 * Tests setting the charset explicitly in the constructor
 	 */
+	@Test
 	public void testCharset2()
 	{
 		Charset expected = Charset.forName("ISO-8859-2");
@@ -413,11 +442,12 @@ public class UrlTest extends TestCase
 	 * 
 	 * @throws Exception
 	 */
+	@Test
 	public void testCharset3() throws Exception
 	{
 		Charset expected = Charset.forName("ISO-8859-1");
 		Url url = new Url(expected);
-		Url clonedUrl = (Url)cloneObject(url);
+		Url clonedUrl = cloneObject(url);
 		assertEquals(expected, clonedUrl.getCharset());
 	}
 
@@ -430,6 +460,10 @@ public class UrlTest extends TestCase
 		return (Url)ois.readObject();
 	}
 
+	/**
+	 * 
+	 */
+	@Test
 	public void testParseRelativeUrl()
 	{
 		Url url = Url.parse("foo");
@@ -455,6 +489,10 @@ public class UrlTest extends TestCase
 		assertTrue(url.isAbsolute());
 	}
 
+	/**
+	 * 
+	 */
+	@Test
 	public void testParseAbsoluteUrl()
 	{
 		Url url = Url.parse("ftp://myhost:8081");