You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/09/13 23:03:29 UTC
svn commit: r1170348 - in /commons/proper/chain/trunk: ./
src/test/java/org/apache/commons/chain/config/
src/test/java/org/apache/commons/chain/generic/
src/test/java/org/apache/commons/chain/impl/
src/test/java/org/apache/commons/chain/web/ src/test/j...
Author: simonetripodi
Date: Tue Sep 13 21:03:29 2011
New Revision: 1170348
URL: http://svn.apache.org/viewvc?rev=1170348&view=rev
Log:
[CHAIN-54] upgrate JUnit dependency to latest released version and adapt tests
Modified:
commons/proper/chain/trunk/pom.xml
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/ChainResourcesTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ChainProcessorTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommandTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommandTestCase.java
commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletWebContextTestCase.java
Modified: commons/proper/chain/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/pom.xml?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/pom.xml (original)
+++ commons/proper/chain/trunk/pom.xml Tue Sep 13 21:03:29 2011
@@ -236,7 +236,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <version>4.9</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParser2TestCase.java Tue Sep 13 21:03:29 2011
@@ -17,16 +17,31 @@
package org.apache.commons.chain.config;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.Iterator;
+
import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.Command;
import org.apache.commons.chain.Context;
-import org.apache.commons.chain.impl.*;
+import org.apache.commons.chain.impl.AddingCommand;
+import org.apache.commons.chain.impl.CatalogBase;
+import org.apache.commons.chain.impl.CatalogFactoryBase;
+import org.apache.commons.chain.impl.ChainBase;
+import org.apache.commons.chain.impl.ContextBase;
+import org.apache.commons.chain.impl.DelegatingCommand;
+import org.apache.commons.chain.impl.DelegatingFilter;
+import org.apache.commons.chain.impl.ExceptionCommand;
+import org.apache.commons.chain.impl.ExceptionFilter;
+import org.apache.commons.chain.impl.NonDelegatingCommand;
+import org.apache.commons.chain.impl.NonDelegatingFilter;
import org.apache.commons.digester.Digester;
-
-import java.util.Iterator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
@@ -35,26 +50,13 @@ import java.util.Iterator;
* for the commands and chains used in the test.</p>
*/
-public class ConfigParser2TestCase extends TestCase {
+public class ConfigParser2TestCase {
private static final String DEFAULT_XML =
"/org/apache/commons/chain/config/test-config-2.xml";
- // ------------------------------------------------------------ Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ConfigParser2TestCase(String name) {
- super(name);
- }
-
-
// ------------------------------------------------------ Instance Variables
@@ -82,6 +84,7 @@ public class ConfigParser2TestCase exten
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
catalog = new CatalogBase();
context = new ContextBase();
@@ -90,16 +93,9 @@ public class ConfigParser2TestCase exten
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(ConfigParser2TestCase.class));
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
parser = null;
context = null;
@@ -111,6 +107,7 @@ public class ConfigParser2TestCase exten
// Load the default test-config.xml file and examine the results
+ @Test
public void testDefault() throws Exception {
// Check overall command count
@@ -163,6 +160,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute2a"
+ @Test
public void testExecute2a() throws Exception {
load(DEFAULT_XML);
@@ -174,6 +172,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute2b"
+ @Test
public void testExecute2b() throws Exception {
load(DEFAULT_XML);
@@ -185,6 +184,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute2c"
+ @Test
public void testExecute2c() throws Exception {
load(DEFAULT_XML);
@@ -200,6 +200,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute2d"
+ @Test
public void testExecute2d() throws Exception {
load(DEFAULT_XML);
@@ -215,6 +216,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute4a"
+ @Test
public void testExecute4a() throws Exception {
load(DEFAULT_XML);
@@ -226,6 +228,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute2b"
+ @Test
public void testExecute4b() throws Exception {
load(DEFAULT_XML);
@@ -237,6 +240,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute4c"
+ @Test
public void testExecute4c() throws Exception {
load(DEFAULT_XML);
@@ -252,6 +256,7 @@ public class ConfigParser2TestCase exten
// Test execution of chain "Execute4d"
+ @Test
public void testExecute4d() throws Exception {
load(DEFAULT_XML);
@@ -267,6 +272,7 @@ public class ConfigParser2TestCase exten
// Test a pristine ConfigParser instance
+ @Test
public void testPristine() {
// Validate the "digester" property
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/ConfigParserTestCase.java Tue Sep 13 21:03:29 2011
@@ -17,42 +17,44 @@
package org.apache.commons.chain.config;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.Iterator;
+
import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.Command;
import org.apache.commons.chain.Context;
-import org.apache.commons.chain.impl.*;
+import org.apache.commons.chain.impl.AddingCommand;
+import org.apache.commons.chain.impl.CatalogBase;
+import org.apache.commons.chain.impl.CatalogFactoryBase;
+import org.apache.commons.chain.impl.ChainBase;
+import org.apache.commons.chain.impl.ContextBase;
+import org.apache.commons.chain.impl.DelegatingCommand;
+import org.apache.commons.chain.impl.DelegatingFilter;
+import org.apache.commons.chain.impl.ExceptionCommand;
+import org.apache.commons.chain.impl.ExceptionFilter;
+import org.apache.commons.chain.impl.NonDelegatingCommand;
+import org.apache.commons.chain.impl.NonDelegatingFilter;
import org.apache.commons.digester.Digester;
-
-import java.util.Iterator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* <p>Test Case for <code>org.apache.commons.chain.config.ConfigParser</code>.</p>
*/
-public class ConfigParserTestCase extends TestCase {
+public class ConfigParserTestCase {
private static final String DEFAULT_XML =
"/org/apache/commons/chain/config/test-config.xml";
- // ------------------------------------------------------------ Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ConfigParserTestCase(String name) {
- super(name);
- }
-
-
// ------------------------------------------------------ Instance Variables
@@ -80,6 +82,7 @@ public class ConfigParserTestCase extend
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
catalog = new CatalogBase();
context = new ContextBase();
@@ -88,16 +91,9 @@ public class ConfigParserTestCase extend
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(ConfigParserTestCase.class));
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
parser = null;
context = null;
@@ -109,6 +105,7 @@ public class ConfigParserTestCase extend
// Load the default test-config.xml file and examine the results
+ @Test
public void testDefault() throws Exception {
// Check overall command count
@@ -161,6 +158,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute2a"
+ @Test
public void testExecute2a() throws Exception {
load(DEFAULT_XML);
@@ -172,6 +170,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute2b"
+ @Test
public void testExecute2b() throws Exception {
load(DEFAULT_XML);
@@ -183,6 +182,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute2c"
+ @Test
public void testExecute2c() throws Exception {
load(DEFAULT_XML);
@@ -198,6 +198,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute2d"
+ @Test
public void testExecute2d() throws Exception {
load(DEFAULT_XML);
@@ -213,6 +214,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute4a"
+ @Test
public void testExecute4a() throws Exception {
load(DEFAULT_XML);
@@ -224,6 +226,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute2b"
+ @Test
public void testExecute4b() throws Exception {
load(DEFAULT_XML);
@@ -235,6 +238,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute4c"
+ @Test
public void testExecute4c() throws Exception {
load(DEFAULT_XML);
@@ -250,6 +254,7 @@ public class ConfigParserTestCase extend
// Test execution of chain "Execute4d"
+ @Test
public void testExecute4d() throws Exception {
load(DEFAULT_XML);
@@ -265,6 +270,7 @@ public class ConfigParserTestCase extend
// Test a pristine ConfigParser instance
+ @Test
public void testPristine() {
// Validate the "digester" property
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchCommandTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,31 +16,20 @@
*/
package org.apache.commons.chain.generic;
-import junit.framework.TestCase;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
import org.apache.commons.chain.Context;
import org.apache.commons.chain.impl.ContextBase;
+import org.junit.Test;
/* JUnitTest case for class: org.apache.commons.chain.generic.DispatchCommand */
-public class DispatchCommandTestCase extends TestCase {
-
- public DispatchCommandTestCase(String _name) {
- super(_name);
- }
-
- /* setUp method for test case */
- protected void setUp() {
- }
-
- /* tearDown method for test case */
- protected void tearDown() {
- }
-
- /* Executes the test case */
- public static void main(String[] argv) {
- String[] testCaseList = {DispatchCommandTestCase.class.getName()};
- junit.textui.TestRunner.main(testCaseList);
- }
+public class DispatchCommandTestCase {
+ @Test
public void testMethodDispatch() throws Exception {
TestCommand test = new TestCommand();
@@ -56,6 +45,7 @@ public class DispatchCommandTestCase ext
}
+ @Test
public void testMethodKeyDispatch() throws Exception {
TestCommand test = new TestCommand();
@@ -71,6 +61,7 @@ public class DispatchCommandTestCase ext
}
+ @Test
public void testAlternateContext() throws Exception {
TestAlternateContextCommand test = new TestAlternateContextCommand();
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/DispatchLookupCommandTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,16 +16,17 @@
*/
package org.apache.commons.chain.generic;
+import static junit.framework.Assert.*;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
import org.apache.commons.chain.Context;
import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.impl.CatalogBase;
import org.apache.commons.chain.impl.ContextBase;
import org.apache.commons.chain.impl.CatalogFactoryBase;
import org.apache.commons.chain.impl.NonDelegatingCommand;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* <p>Test case for the <code>DispatchLookupCommand</code> class.</p>
@@ -34,7 +35,7 @@ import org.apache.commons.chain.impl.Non
* @version $Revision$
*/
-public class DispatchLookupCommandTestCase extends TestCase {
+public class DispatchLookupCommandTestCase {
// ---------------------------------------------------- Instance Variables
@@ -55,24 +56,13 @@ public class DispatchLookupCommandTestCa
protected Context context = null;
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public DispatchLookupCommandTestCase(String name) {
- super(name);
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
catalog = new CatalogBase();
CatalogFactoryBase.getInstance().setCatalog(catalog);
@@ -80,19 +70,10 @@ public class DispatchLookupCommandTestCa
context = new ContextBase();
}
-
- /**
- * Return the tests included in this test suite.
- *
- * @return The suite of tests to run
- */
- public static Test suite() {
- return (new TestSuite(DispatchLookupCommandTestCase.class));
- }
-
/**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
catalog = null;
CatalogFactoryBase.clear();
@@ -106,6 +87,7 @@ public class DispatchLookupCommandTestCa
// Test ability to lookup and execute a dispatch method on a single
// non-delegating command
+ @Test
public void testExecuteDispatchLookup_1a() {
// use default catalog
@@ -138,6 +120,7 @@ public class DispatchLookupCommandTestCa
}
// Test IllegalArgumentException when incorrect command name specified
+ @Test
public void testExecuteDispatchLookup_2() {
// use default catalog
@@ -161,6 +144,7 @@ public class DispatchLookupCommandTestCa
// Test ability to lookup and execute a dispatch method on a single
// non-delegating command (using context to specify method name)
+ @Test
public void testExecuteDispatchLookup_3() {
// use default catalog
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/generic/LookupCommandTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,19 +16,24 @@
*/
package org.apache.commons.chain.generic;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.Chain;
import org.apache.commons.chain.Context;
-import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.impl.CatalogBase;
-import org.apache.commons.chain.impl.ContextBase;
-import org.apache.commons.chain.impl.ChainBase;
import org.apache.commons.chain.impl.CatalogFactoryBase;
+import org.apache.commons.chain.impl.ChainBase;
+import org.apache.commons.chain.impl.ContextBase;
import org.apache.commons.chain.impl.DelegatingCommand;
import org.apache.commons.chain.impl.NonDelegatingCommand;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* <p>Test case for the <code>LookupCommand</code> class.</p>
@@ -37,7 +42,7 @@ import org.apache.commons.chain.impl.Non
* @version $Revision$
*/
-public class LookupCommandTestCase extends TestCase {
+public class LookupCommandTestCase {
// ---------------------------------------------------- Instance Variables
@@ -58,24 +63,13 @@ public class LookupCommandTestCase exten
protected Context context = null;
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public LookupCommandTestCase(String name) {
- super(name);
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
catalog = new CatalogBase();
CatalogFactoryBase.getInstance().setCatalog(catalog);
@@ -83,17 +77,10 @@ public class LookupCommandTestCase exten
context = new ContextBase();
}
-
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(LookupCommandTestCase.class));
- }
-
/**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
catalog = null;
CatalogFactoryBase.clear();
@@ -106,6 +93,7 @@ public class LookupCommandTestCase exten
// Test ability to lookup and execute single non-delegating command
+ @Test
public void testExecuteMethodLookup_1a() {
// use default catalog
@@ -122,6 +110,7 @@ public class LookupCommandTestCase exten
}
// Test ability to lookup and execute a chain
+ @Test
public void testExecuteMethodLookup_1b() {
ChainBase<Context> chain = new ChainBase<Context>();
@@ -144,6 +133,7 @@ public class LookupCommandTestCase exten
// Test ability to lookup and execute single non-delegating command
// using the context
+ @Test
public void testExecuteMethodLookup_2a() {
// use default catalog
@@ -161,6 +151,7 @@ public class LookupCommandTestCase exten
}
// Test ability to lookup and execute a chain using the context
+ @Test
public void testExecuteMethodLookup_2b() {
Chain<Context> chain = new ChainBase<Context>();
@@ -183,6 +174,7 @@ public class LookupCommandTestCase exten
}
// Test ability to lookup and execute single non-delegating command, ignoring its result
+ @Test
public void testExecuteMethodLookup_3a() {
// use default catalog
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogBaseTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,14 +16,18 @@
*/
package org.apache.commons.chain.impl;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.Iterator;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.Command;
-
-import java.util.Iterator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
@@ -33,7 +37,7 @@ import java.util.Iterator;
* @version $Revision$ $Date$
*/
-public class CatalogBaseTestCase extends TestCase {
+public class CatalogBaseTestCase {
// ---------------------------------------------------- Instance Variables
@@ -45,39 +49,21 @@ public class CatalogBaseTestCase extends
protected CatalogBase catalog = null;
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public CatalogBaseTestCase(String name) {
- super(name);
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
catalog = new CatalogBase();
}
-
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(CatalogBaseTestCase.class));
- }
-
/**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
catalog = null;
}
@@ -87,6 +73,7 @@ public class CatalogBaseTestCase extends
// Test adding commands
+ @Test
public void testAddCommand() {
addCommands();
checkCommandCount(8);
@@ -94,6 +81,7 @@ public class CatalogBaseTestCase extends
// Test getting commands
+ @Test
public void testGetCommand() {
addCommands();
@@ -138,6 +126,7 @@ public class CatalogBaseTestCase extends
// Test pristine instance
+ @Test
public void testPristine() {
checkCommandCount(0);
assertNull(catalog.getCommand("AddingCommand"));
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/CatalogFactoryBaseTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,14 +16,21 @@
*/
package org.apache.commons.chain.impl;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import java.util.Iterator;
+
import org.apache.commons.chain.Catalog;
import org.apache.commons.chain.CatalogFactory;
import org.apache.commons.chain.Command;
-import org.apache.commons.chain.impl.CatalogBase;
-import java.util.Iterator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* <p>Test case for the <code>CatalogFactoryBase</code> class.</p>
@@ -32,7 +39,7 @@ import java.util.Iterator;
* @version $Revision$ $Date$
*/
-public class CatalogFactoryBaseTestCase extends TestCase {
+public class CatalogFactoryBaseTestCase {
// ---------------------------------------------------- Instance Variables
@@ -44,41 +51,22 @@ public class CatalogFactoryBaseTestCase
protected CatalogFactory factory = null;
- // ---------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public CatalogFactoryBaseTestCase(String name) {
- super(name);
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
* <p>Set up instance variables required by this test case.</p>
*/
+ @Before
public void setUp() {
CatalogFactory.clear();
factory = CatalogFactory.getInstance();
}
-
- /**
- * <p>Return the tests included in this test suite.</p>
- */
- public static Test suite() {
- return (new TestSuite(CatalogFactoryBaseTestCase.class));
- }
-
/**
* <p>Tear down instance variables required by this test case.</p>
*/
+ @After
public void tearDown() {
factory = null;
}
@@ -90,6 +78,7 @@ public class CatalogFactoryBaseTestCase
/**
* <p>Test a pristine instance of {@link CatalogFactory}.</p>
*/
+ @Test
public void testPristine() {
assertNotNull(factory);
@@ -103,6 +92,7 @@ public class CatalogFactoryBaseTestCase
/**
* <p>Test the default {@link Catalog} instance.</p>
*/
+ @Test
public void testDefaultCatalog() {
Catalog catalog = new CatalogBase();
@@ -116,6 +106,7 @@ public class CatalogFactoryBaseTestCase
/**
* <p>Test adding a specifically named {@link Catalog} instance.</p>
*/
+ @Test
public void testSpecificCatalog() {
Catalog catalog = new CatalogBase();
@@ -137,6 +128,7 @@ public class CatalogFactoryBaseTestCase
/**
* <p>Test <code>getCatalog()</code> method.</p>
*/
+ @Test
public void testCatalogIdentifier() {
Catalog defaultCatalog = new CatalogBase();
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ChainBaseTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,16 +16,19 @@
*/
package org.apache.commons.chain.impl;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.apache.commons.chain.Chain;
import org.apache.commons.chain.Command;
import org.apache.commons.chain.Context;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
@@ -35,7 +38,7 @@ import org.apache.commons.chain.Context;
* @version $Revision$ $Date$
*/
-public class ChainBaseTestCase extends TestCase {
+public class ChainBaseTestCase {
// ---------------------------------------------------- Instance Variables
@@ -53,40 +56,22 @@ public class ChainBaseTestCase extends T
protected Context context = null;
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ChainBaseTestCase(String name) {
- super(name);
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
chain = new ChainBase();
context = new ContextBase();
}
-
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(ChainBaseTestCase.class));
- }
-
/**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
chain = null;
context = null;
@@ -97,6 +82,7 @@ public class ChainBaseTestCase extends T
// Test the ability to add commands
+ @Test
public void testCommands() {
checkCommandCount(0);
@@ -117,6 +103,7 @@ public class ChainBaseTestCase extends T
// Test execution of a single non-delegating command
+ @Test
public void testExecute1a() {
chain.addCommand(new NonDelegatingCommand("1"));
try {
@@ -130,6 +117,7 @@ public class ChainBaseTestCase extends T
// Test execution of a single delegating command
+ @Test
public void testExecute1b() {
chain.addCommand(new DelegatingCommand("1"));
try {
@@ -143,6 +131,7 @@ public class ChainBaseTestCase extends T
// Test execution of a single exception-throwing command
+ @Test
public void testExecute1c() {
chain.addCommand(new ExceptionCommand("1"));
try {
@@ -157,6 +146,7 @@ public class ChainBaseTestCase extends T
// Test execution of an attempt to add a new Command while executing
+ @Test
public void testExecute1d() {
chain.addCommand(new AddingCommand("1", chain));
try {
@@ -171,6 +161,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should return true
+ @Test
public void testExecute2a() {
chain.addCommand(new DelegatingCommand("1"));
chain.addCommand(new DelegatingCommand("2"));
@@ -186,6 +177,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should return false
+ @Test
public void testExecute2b() {
chain.addCommand(new DelegatingCommand("1"));
chain.addCommand(new DelegatingCommand("2"));
@@ -201,6 +193,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should throw an exception
+ @Test
public void testExecute2c() {
chain.addCommand(new DelegatingCommand("1"));
chain.addCommand(new DelegatingCommand("2"));
@@ -217,6 +210,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should throw an exception in the middle
+ @Test
public void testExecute2d() {
chain.addCommand(new DelegatingCommand("1"));
chain.addCommand(new ExceptionCommand("2"));
@@ -233,6 +227,7 @@ public class ChainBaseTestCase extends T
// Test execution of a single non-delegating filter
+ @Test
public void testExecute3a() {
chain.addCommand(new NonDelegatingFilter("1", "a"));
try {
@@ -246,6 +241,7 @@ public class ChainBaseTestCase extends T
// Test execution of a single delegating filter
+ @Test
public void testExecute3b() {
chain.addCommand(new DelegatingFilter("1", "a"));
try {
@@ -259,6 +255,7 @@ public class ChainBaseTestCase extends T
// Test execution of a single exception-throwing filter
+ @Test
public void testExecute3c() {
chain.addCommand(new ExceptionFilter("1", "a"));
try {
@@ -273,6 +270,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should return true
+ @Test
public void testExecute4a() {
chain.addCommand(new DelegatingFilter("1", "a"));
chain.addCommand(new DelegatingCommand("2"));
@@ -288,6 +286,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should return false
+ @Test
public void testExecute4b() {
chain.addCommand(new DelegatingCommand("1"));
chain.addCommand(new DelegatingFilter("2", "b"));
@@ -303,6 +302,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should throw an exception
+ @Test
public void testExecute4c() {
chain.addCommand(new DelegatingFilter("1", "a"));
chain.addCommand(new DelegatingFilter("2", "b"));
@@ -319,6 +319,7 @@ public class ChainBaseTestCase extends T
// Test execution of a chain that should throw an exception in the middle
+ @Test
public void testExecute4d() {
chain.addCommand(new DelegatingFilter("1", "a"));
chain.addCommand(new ExceptionFilter("2", "b"));
@@ -335,6 +336,7 @@ public class ChainBaseTestCase extends T
// Test state of newly created instance
+ @Test
public void testNewInstance() {
checkCommandCount(0);
}
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/ContextBaseTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,6 +16,11 @@
*/
package org.apache.commons.chain.impl;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -28,11 +33,11 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
import org.apache.commons.chain.Context;
import org.apache.commons.chain.web.WebContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
@@ -43,7 +48,7 @@ import org.apache.commons.chain.web.WebC
* @version $Revision$ $Date$
*/
-public class ContextBaseTestCase extends TestCase {
+public class ContextBaseTestCase {
// ---------------------------------------------------- Instance Variables
@@ -55,40 +60,21 @@ public class ContextBaseTestCase extends
protected Context context = null;
-
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ContextBaseTestCase(String name) {
- super(name);
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
context = createContext();
}
-
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(ContextBaseTestCase.class));
- }
-
/**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
context = null;
}
@@ -98,6 +84,7 @@ public class ContextBaseTestCase extends
// Test ability to get, put, and remove attributes
+ @Test
public void testAttributes() {
Object value = null;
@@ -157,6 +144,7 @@ public class ContextBaseTestCase extends
// Test containsKey() and containsValue()
+ @Test
public void testContains() {
assertTrue(!context.containsKey("bop"));
@@ -172,6 +160,7 @@ public class ContextBaseTestCase extends
// Test equals() and hashCode()
+ @Test
public void testEquals() {
// Compare to self
@@ -198,6 +187,7 @@ public class ContextBaseTestCase extends
// Test keySet()
+ @Test
public void testKeySet() {
Set keySet = null;
@@ -298,6 +288,7 @@ public class ContextBaseTestCase extends
// Test state of newly created instance
+ @Test
public void testPristine() {
checkAttributeCount(0);
@@ -308,6 +299,7 @@ public class ContextBaseTestCase extends
// Test putAll()
+ @Test
public void testPutAll() {
// Check preconditions
@@ -345,6 +337,7 @@ public class ContextBaseTestCase extends
// Test serialization
+ @Test
public void testSeriaization() throws Exception {
// ContextBase is implicitly declared Serializable because it
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/impl/TestContextTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,10 +16,14 @@
*/
package org.apache.commons.chain.impl;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.commons.chain.Context;
+import org.junit.Before;
+import org.junit.Test;
/**
@@ -30,41 +34,23 @@ import org.apache.commons.chain.Context;
public class TestContextTestCase extends ContextBaseTestCase {
- // ------------------------------------------------------------ Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public TestContextTestCase(String name) {
- super(name);
- }
-
-
// ---------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
context = createContext();
}
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(TestContextTestCase.class));
- }
-
-
// ------------------------------------------------- Individual Test Methods
// Test state of newly created instance
+ @Test
public void testPristine() {
super.testPristine();
@@ -76,6 +62,7 @@ public class TestContextTestCase extends
// Test a read only property on the Context implementation class
+ @Test
public void testReadOnly() {
Object readOnly = context.get("readOnly");
@@ -97,6 +84,7 @@ public class TestContextTestCase extends
// Test a read write property on the Context implementation class
+ @Test
public void testReadWrite() {
Object readWrite = context.get("readWrite");
@@ -116,6 +104,7 @@ public class TestContextTestCase extends
// Test a write only property on the Context implementation class
+ @Test
public void testWriteOnly() {
Object writeOnly = ((TestContext) context).returnWriteOnly();
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/ChainResourcesTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/ChainResourcesTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/ChainResourcesTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/ChainResourcesTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,27 +16,14 @@
*/
package org.apache.commons.chain.web;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.Test;
// Test case for org.apache.commons.chain.web.ChainResources
-public class ChainResourcesTestCase extends TestCase {
-
-
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ChainResourcesTestCase(String name) {
- super(name);
- }
+public class ChainResourcesTestCase {
// ----------------------------------------------------- Instance Variables
@@ -60,6 +47,7 @@ public class ChainResourcesTestCase exte
// ------------------------------------------------ Individual Test Methods
+ @Test
public void testGetPaths() throws Exception {
for (int i = 0; i < data.length; i++) {
TestData datum = data[i];
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletGetLocaleCommandTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,34 +16,28 @@
*/
package org.apache.commons.chain.web.portlet;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.commons.chain.Context;
+import java.util.Locale;
import javax.portlet.PortletContext;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.PortletSession;
-import java.util.Locale;
-
-// Test case for org.apache.commons.chain.web.portlet.PortletGetLocaleCommand
-
-public class PortletGetLocaleCommandTestCase extends TestCase {
+import org.apache.commons.chain.Context;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
- // ---------------------------------------------------------- Constructors
+// Test case for org.apache.commons.chain.web.portlet.PortletGetLocaleCommand
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public PortletGetLocaleCommandTestCase(String name) {
- super(name);
- }
+public class PortletGetLocaleCommandTestCase {
// ----------------------------------------------------- Instance Variables
@@ -68,6 +62,7 @@ public class PortletGetLocaleCommandTest
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
locale = new Locale("en", "US");
@@ -86,18 +81,9 @@ public class PortletGetLocaleCommandTest
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(PortletGetLocaleCommandTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
pcontext = null;
@@ -115,6 +101,7 @@ public class PortletGetLocaleCommandTest
// Test configured behavior
+ @Test
public void testConfigured() throws Exception {
command.setLocaleKey("special");
@@ -125,6 +112,7 @@ public class PortletGetLocaleCommandTest
// Test default behavior
+ @Test
public void testDefault() throws Exception {
assertEquals("locale", command.getLocaleKey());
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/portlet/PortletWebContextTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,12 +16,14 @@
*/
package org.apache.commons.chain.web.portlet;
+import static junit.framework.Assert.*;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.commons.chain.Context;
import org.apache.commons.chain.impl.ContextBaseTestCase;
import org.apache.commons.chain.web.WebContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import javax.portlet.PortletContext;
import javax.portlet.PortletRequest;
@@ -42,18 +44,6 @@ import java.util.Collection;
public class PortletWebContextTestCase extends ContextBaseTestCase {
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public PortletWebContextTestCase(String name) {
- super(name);
- }
-
-
// ----------------------------------------------------- Instance Variables
@@ -70,6 +60,7 @@ public class PortletWebContextTestCase e
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
pcontext = new MockPortletContext();
pcontext.setAttribute("akey1", "avalue1");
@@ -94,16 +85,9 @@ public class PortletWebContextTestCase e
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(PortletWebContextTestCase.class));
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
pcontext = null;
session = null;
@@ -117,6 +101,7 @@ public class PortletWebContextTestCase e
// Test getApplicationScope()
+ @Test
public void testApplicationScope() {
Map map = ((WebContext) context).getApplicationScope();
@@ -180,6 +165,7 @@ public class PortletWebContextTestCase e
// Test equals() and hashCode()
// Copied from ContextBaseTestCase with customized creation of "other"
+ @Test
public void testEquals() {
// Compare to self
@@ -206,6 +192,7 @@ public class PortletWebContextTestCase e
// Test getHeader()
+ @Test
public void testHeader() {
Map map = ((WebContext) context).getHeader();
@@ -225,6 +212,7 @@ public class PortletWebContextTestCase e
// Test getHeaderValues()
+ @Test
public void testHeaderValues() {
Map map = ((WebContext) context).getHeaderValues();
@@ -244,6 +232,7 @@ public class PortletWebContextTestCase e
// Test getInitParam()
+ @Test
public void testInitParam() {
Map map = ((WebContext) context).getInitParam();
@@ -294,6 +283,7 @@ public class PortletWebContextTestCase e
// Test getParam()
+ @Test
public void testParam() {
Map map = ((WebContext) context).getParam();
@@ -340,6 +330,7 @@ public class PortletWebContextTestCase e
// Test getParamValues()
+ @Test
public void testParamValues() {
Map map = ((WebContext) context).getParamValues();
@@ -395,6 +386,7 @@ public class PortletWebContextTestCase e
// Test getCookies()
+ @Test
public void testCookies() {
Map map = ((WebContext) context).getCookies();
@@ -412,6 +404,7 @@ public class PortletWebContextTestCase e
}
// Test state of newly created instance
+ @Test
public void testPristine() {
super.testPristine();
@@ -452,6 +445,7 @@ public class PortletWebContextTestCase e
// Test release()
+ @Test
public void testRelease() {
PortletWebContext pwcontext = (PortletWebContext) context;
@@ -481,6 +475,7 @@ public class PortletWebContextTestCase e
// Test getRequestScope()
+ @Test
public void testRequestScope() {
Map map = ((WebContext) context).getRequestScope();
@@ -541,6 +536,7 @@ public class PortletWebContextTestCase e
// Test getSessionScope()
+ @Test
public void testSessionScope() {
Map map = ((WebContext) context).getSessionScope();
@@ -602,6 +598,7 @@ public class PortletWebContextTestCase e
// Test getSessionScope() without Session
+ @Test
public void testSessionScopeWithoutSession() {
// Create a Context without a session
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ChainProcessorTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ChainProcessorTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ChainProcessorTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ChainProcessorTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,6 +16,7 @@
*/
package org.apache.commons.chain.web.servlet;
+import static junit.framework.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -24,50 +25,17 @@ import java.io.ObjectOutputStream;
import javax.servlet.ServletConfig;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Test;
/**
* Test case for {@link ChainProcessor}.
*/
-public class ChainProcessorTestCase extends TestCase {
-
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ChainProcessorTestCase(String name) {
- super(name);
- }
-
- /**
- * Return the tests included in this test suite.
- * @return the test suite
- */
- public static Test suite() {
- return new TestSuite(ChainProcessorTestCase.class);
- }
-
-
- /**
- * Set up instance variables required by this test case.
- */
- public void setUp() {
- }
-
- /**
- * Tear down instance variables required by this test case.
- */
- public void tearDown() {
- }
+public class ChainProcessorTestCase {
/**
* Test serialization.
*/
+ @Test
public void testSerialize() {
// Initialize a ChainProcessor
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommandTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletGetLocaleCommandTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,34 +16,28 @@
*/
package org.apache.commons.chain.web.servlet;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.commons.chain.Context;
+import java.util.Locale;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import java.util.Locale;
-
-// Test case for org.apache.commons.chain.web.servlet.ServletGetLocaleCommand
-
-public class ServletGetLocaleCommandTestCase extends TestCase {
+import org.apache.commons.chain.Context;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
- // ---------------------------------------------------------- Constructors
+// Test case for org.apache.commons.chain.web.servlet.ServletGetLocaleCommand
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ServletGetLocaleCommandTestCase(String name) {
- super(name);
- }
+public class ServletGetLocaleCommandTestCase {
// ----------------------------------------------------- Instance Variables
@@ -68,6 +62,7 @@ public class ServletGetLocaleCommandTest
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
locale = new Locale("en", "US");
@@ -89,18 +84,9 @@ public class ServletGetLocaleCommandTest
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(ServletGetLocaleCommandTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
scontext = null;
@@ -118,6 +104,7 @@ public class ServletGetLocaleCommandTest
// Test configured behavior
+ @Test
public void testConfigured() throws Exception {
command.setLocaleKey("special");
@@ -128,6 +115,7 @@ public class ServletGetLocaleCommandTest
// Test default behavior
+ @Test
public void testDefault() throws Exception {
assertEquals("locale", command.getLocaleKey());
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommandTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommandTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommandTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletSetLocaleCommandTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,34 +16,27 @@
*/
package org.apache.commons.chain.web.servlet;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.commons.chain.Context;
+import java.util.Locale;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import java.util.Locale;
-
-// Test case for org.apache.commons.chain.web.servlet.ServletSetLocaleCommand
-
-public class ServletSetLocaleCommandTestCase extends TestCase {
+import org.apache.commons.chain.Context;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
- // ---------------------------------------------------------- Constructors
+// Test case for org.apache.commons.chain.web.servlet.ServletSetLocaleCommand
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ServletSetLocaleCommandTestCase(String name) {
- super(name);
- }
+public class ServletSetLocaleCommandTestCase {
// ----------------------------------------------------- Instance Variables
@@ -59,7 +52,7 @@ public class ServletSetLocaleCommandTest
// Chain API Objects
protected Context context = null;
- protected ServletGetLocaleCommand command = null;
+ protected ServletSetLocaleCommand command = null;
// -------------------------------------------------- Overall Test Methods
@@ -68,6 +61,7 @@ public class ServletSetLocaleCommandTest
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
locale = new Locale("en", "US");
@@ -82,17 +76,7 @@ public class ServletSetLocaleCommandTest
// Set up Chain API Objects
context = new ServletWebContext(scontext, request, response);
- command = new ServletGetLocaleCommand();
-
- }
-
-
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(ServletGetLocaleCommandTestCase.class));
+ command = new ServletSetLocaleCommand();
}
@@ -100,6 +84,7 @@ public class ServletSetLocaleCommandTest
/**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
scontext = null;
@@ -117,6 +102,7 @@ public class ServletSetLocaleCommandTest
// Test configured behavior
+ @Test
public void testConfigured() throws Exception {
command.setLocaleKey("special");
@@ -127,6 +113,7 @@ public class ServletSetLocaleCommandTest
// Test default behavior
+ @Test
public void testDefault() throws Exception {
assertEquals("locale", command.getLocaleKey());
@@ -138,7 +125,7 @@ public class ServletSetLocaleCommandTest
// --------------------------------------------------------- Support Methods
- protected void check(Context context, ServletGetLocaleCommand command)
+ protected void check(Context context, ServletSetLocaleCommand command)
throws Exception {
String localeKey = command.getLocaleKey();
Modified: commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletWebContextTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletWebContextTestCase.java?rev=1170348&r1=1170347&r2=1170348&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletWebContextTestCase.java (original)
+++ commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/web/servlet/ServletWebContextTestCase.java Tue Sep 13 21:03:29 2011
@@ -16,23 +16,31 @@
*/
package org.apache.commons.chain.web.servlet;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.commons.chain.Context;
-import org.apache.commons.chain.impl.ContextBaseTestCase;
-import org.apache.commons.chain.web.WebContext;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
import javax.servlet.ServletContext;
+import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import javax.servlet.http.Cookie;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collection;
+
+import org.apache.commons.chain.Context;
+import org.apache.commons.chain.impl.ContextBaseTestCase;
+import org.apache.commons.chain.web.WebContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
@@ -43,18 +51,6 @@ import java.util.Collection;
public class ServletWebContextTestCase extends ContextBaseTestCase {
- // ---------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ServletWebContextTestCase(String name) {
- super(name);
- }
-
-
// ----------------------------------------------------- Instance Variables
@@ -71,6 +67,7 @@ public class ServletWebContextTestCase e
/**
* Set up instance variables required by this test case.
*/
+ @Before
public void setUp() {
scontext = new MockServletContext();
scontext.setAttribute("akey1", "avalue1");
@@ -103,16 +100,9 @@ public class ServletWebContextTestCase e
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(ServletWebContextTestCase.class));
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
+ @After
public void tearDown() {
scontext = null;
session = null;
@@ -126,6 +116,7 @@ public class ServletWebContextTestCase e
// Test getApplicationScope()
+ @Test
public void testApplicationScope() {
Map map = ((WebContext) context).getApplicationScope();
@@ -188,6 +179,7 @@ public class ServletWebContextTestCase e
// Test equals() and hashCode()
// Copied from ContextBaseTestCase with customized creation of "other"
+ @Test
public void testEquals() {
// FIXME - ServletWebContext needs a better equals()
@@ -216,6 +208,7 @@ public class ServletWebContextTestCase e
// Test getHeader()
+ @Test
public void testHeader() {
Map map = ((WebContext) context).getHeader();
@@ -263,6 +256,7 @@ public class ServletWebContextTestCase e
// Test getHeaderValues()
+ @Test
public void testHeaderValues() {
Map map = ((WebContext) context).getHeaderValues();
@@ -321,6 +315,7 @@ public class ServletWebContextTestCase e
// Test getInitParam()
+ @Test
public void testInitParam() {
Map map = ((WebContext) context).getInitParam();
@@ -371,6 +366,7 @@ public class ServletWebContextTestCase e
// Test getParam()
+ @Test
public void testParam() {
Map map = ((WebContext) context).getParam();
@@ -417,6 +413,7 @@ public class ServletWebContextTestCase e
// Test getParamValues()
+ @Test
public void testParamValues() {
Map map = ((WebContext) context).getParamValues();
@@ -472,6 +469,7 @@ public class ServletWebContextTestCase e
// Test getCookies()
+ @Test
public void testCookies() {
Map map = ((WebContext) context).getCookies();
@@ -519,6 +517,7 @@ public class ServletWebContextTestCase e
}
// Test state of newly created instance
+ @Test
public void testPristine() {
super.testPristine();
@@ -559,6 +558,7 @@ public class ServletWebContextTestCase e
// Test release()
+ @Test
public void testRelease() {
ServletWebContext swcontext = (ServletWebContext) context;
@@ -590,6 +590,7 @@ public class ServletWebContextTestCase e
// Test getRequestScope()
+ @Test
public void testRequestScope() {
Map map = ((WebContext) context).getRequestScope();
@@ -650,6 +651,7 @@ public class ServletWebContextTestCase e
// Test getSessionScope()
+ @Test
public void testSessionScope() {
Map map = ((WebContext) context).getSessionScope();
@@ -711,6 +713,7 @@ public class ServletWebContextTestCase e
// Test getSessionScope() without Session
+ @Test
public void testSessionScopeWithoutSession() {
// Create a Context without a session