From 32ff96d950af21ab37baa240e23e1f698e342d53 Mon Sep 17 00:00:00 2001 From: kkolinko Date: Mon, 25 Jul 2011 13:18:20 +0000 Subject: [PATCH] Update checkstyle rules to treat imports of "org.junit" as a separate group vs. "org". 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 | 2 +- .../org/apache/catalina/filters/TestCsrfPreventionFilter2.java | 7 +++++-- .../apache/catalina/ha/session/TestSerializablePrincipal.java | 10 ++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/res/checkstyle/checkstyle.xml b/res/checkstyle/checkstyle.xml index b581e0fe7..bf681449c 100644 --- a/res/checkstyle/checkstyle.xml +++ b/res/checkstyle/checkstyle.xml @@ -55,7 +55,7 @@ - + diff --git a/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java b/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java index 2b9cb5cea..acb700559 100644 --- a/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java +++ b/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java @@ -17,16 +17,19 @@ 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; diff --git a/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java b/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java index 7edf83629..b58c9c682 100644 --- a/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java +++ b/test/org/apache/catalina/ha/session/TestSerializablePrincipal.java @@ -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; -- 2.11.0