Update checkstyle rules to treat imports of "org.junit" as a separate group vs. ...
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 25 Jul 2011 13:18:20 +0000 (13:18 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 25 Jul 2011 13:18:20 +0000 (13:18 +0000)
Convert simple tests in the following packages to JUnit 4:
org.apache.catalina.filters.*
org.apache.catalina.ha.session.*

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1150690 13f79535-47bb-0310-9956-ffa450edef68

res/checkstyle/checkstyle.xml
test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java
test/org/apache/catalina/ha/session/TestSerializablePrincipal.java

index b581e0f..bf68144 100644 (file)
@@ -55,7 +55,7 @@
     </module>
     <module name="IllegalImport"/>
     <module name="ImportOrder">
-        <property name="groups" value="java,javax,async,jsp2,junit,org,util"/>
+        <property name="groups" value="java,javax,async,jsp2,junit,org.junit,org,util"/>
         <property name="ordered" value="true"/>
         <property name="separated" value="true"/>
         <property name="option" value="above"/>
index 2b9cb5c..acb7005 100644 (file)
 
 package org.apache.catalina.filters;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
 
 import org.apache.catalina.filters.CsrfPreventionFilter.LruCache;
 
-public class TestCsrfPreventionFilter2 extends TestCase {
+public class TestCsrfPreventionFilter2 {
 
     /**
      * When this test fails, it tends to enter a long running loop but it will
      * eventually finish (after ~70s on a 8-core Windows box).
      */
+    @Test
     public void testLruCacheConcurrency() throws Exception {
         int threadCount = 2;
         long iterationCount = 100000L;
index 7edf836..b58c9c6 100644 (file)
@@ -27,16 +27,22 @@ import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
 
 import org.apache.catalina.realm.GenericPrincipal;
 
-public class TestSerializablePrincipal extends TestCase {
+
+public class TestSerializablePrincipal  {
 
     /**
      * Simple serialization / de-serialization test for bug 43840.
      */
     @SuppressWarnings("null")
+    @Test
     public void testWriteReadPrincipal() {
         // Get a temporary file to use for the serialization test
         File file = null;