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 2010/09/01 20:15:24 UTC
svn commit: r991633 [1/2] - in /commons/proper/digester/trunk: ./
src/test/org/apache/commons/digester/
src/test/org/apache/commons/digester/annotations/
src/test/org/apache/commons/digester/annotations/addressbook/
src/test/org/apache/commons/digester...
Author: simonetripodi
Date: Wed Sep 1 18:15:22 2010
New Revision: 991633
URL: http://svn.apache.org/viewvc?rev=991633&view=rev
Log:
junit dependency upgrated to version 4.8.1
tests migrated to be compliant to junit 4.8.1
Added:
commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectCreationFactoryTestImpl.java
- copied, changed from r990027, commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestObjectCreationFactory.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/ObjectTestImpl.java
- copied, changed from r990027, commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestObject.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/ObjectTestImplRuleInfo.xml
- copied unchanged from r990027, commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestObjectRuleInfo.xml
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/Utils.java
- copied, changed from r990027, commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestAll.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/DigesterRulesSourceTestImpl.java
- copied, changed from r990027, commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/TestDigesterRulesSource.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/ObjectTestImpl.java
- copied, changed from r990027, commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/TestObject.java
Removed:
commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestObjectCreationFactory.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestOthers.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestAll.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestObject.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestObjectRuleInfo.xml
commons/proper/digester/trunk/src/test/org/apache/commons/digester/substitution/TestAll.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/DigesterLoaderTestSuite.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/TestDigesterRulesSource.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/TestObject.java
Modified:
commons/proper/digester/trunk/pom.xml
commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/EBRTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/NamespaceSnapshotTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/NodeCreateRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectParamRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/OtherTestObjectCreationFactory.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/OverlappingCallMethodRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/RegexRulesTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/RuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/RulesBaseTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetNestedPropertiesRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertiesRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertyRuleTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestEntityResolution.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestFactoryCreate.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/URLTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/WDRulesWrapperTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/XMLSchemaTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/annotations/AbstractAnnotatedPojoTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/annotations/addressbook/AddressBookTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/annotations/catalog/CatalogTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/annotations/employee/EmployeeTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/annotations/person/PersonTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/annotations/rss/RssTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/annotations/servletbean/ServletBeanTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestConfigurablePluginAttributes.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestDeclaration.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestDefaultPlugin.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestDelegate.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestInline.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestLocalRules.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestRecursion.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestRuleInfo.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/plugins/TestXmlRuleInfo.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/substitution/VariableExpansionTestCase.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/DigesterLoaderRulesTest.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/DigesterLoaderTest.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/DigesterPatternStackTest.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/FromXmlRuleSetTest.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/IncludeTest.java
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/testCircularRules.xml
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/testfactory.xml
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/testrules.xml
commons/proper/digester/trunk/src/test/org/apache/commons/digester/xmlrules/testrulesinclude.xml
Modified: commons/proper/digester/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/pom.xml?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/pom.xml (original)
+++ commons/proper/digester/trunk/pom.xml Wed Sep 1 18:15:22 2010
@@ -257,7 +257,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/BeanPropertySetterRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,6 +20,8 @@
package org.apache.commons.digester;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
@@ -27,10 +29,9 @@ import java.lang.reflect.InvocationTarge
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
@@ -39,7 +40,7 @@ import org.xml.sax.SAXException;
* This contains tests for the main applications of the rule
* and two more general tests of digester functionality used by this rule.
*/
-public class BeanPropertySetterRuleTestCase extends TestCase {
+public class BeanPropertySetterRuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -63,28 +64,13 @@ public class BeanPropertySetterRuleTestC
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public BeanPropertySetterRuleTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -93,19 +79,9 @@ public class BeanPropertySetterRuleTestC
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(BeanPropertySetterRuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -121,6 +97,7 @@ public class BeanPropertySetterRuleTestC
* This is a general digester test but it fits into here pretty well.
* This tests that the rule calling order is properly enforced.
*/
+ @Test
public void testDigesterRuleCallOrder() throws SAXException, IOException {
List<Rule> callOrder = new ArrayList<Rule>();
@@ -209,6 +186,7 @@ public class BeanPropertySetterRuleTestC
* This is a general digester test but it fits into here pretty well.
* This tests that the body text stack is functioning correctly.
*/
+ @Test
public void testDigesterBodyTextStack() throws SAXException, IOException {
// use the standard rules
@@ -258,6 +236,7 @@ public class BeanPropertySetterRuleTestC
/**
* Test that you can successfully set a given property
*/
+ @Test
public void testSetGivenProperty() throws SAXException, IOException {
// use the standard rules
@@ -306,6 +285,7 @@ public class BeanPropertySetterRuleTestC
/**
* Test that trying to set an unknown property throws an exception.
*/
+ @Test
public void testSetUnknownProperty() {
// going to be setting properties on a SimpleTestBean
@@ -340,6 +320,7 @@ public class BeanPropertySetterRuleTestC
/**
* Test that you can successfully automatically set properties.
*/
+ @Test
public void testAutomaticallySetProperties()
throws SAXException, IOException {
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/CallMethodRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,6 +20,11 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
@@ -27,10 +32,9 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
//import org.apache.commons.logging.impl.SimpleLog;
@@ -41,7 +45,7 @@ import org.xml.sax.SAXException;
*
* @author Christopher Lenz
*/
-public class CallMethodRuleTestCase extends TestCase {
+public class CallMethodRuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -53,28 +57,13 @@ public class CallMethodRuleTestCase exte
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public CallMethodRuleTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -83,19 +72,9 @@ public class CallMethodRuleTestCase exte
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(CallMethodRuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -111,6 +90,7 @@ public class CallMethodRuleTestCase exte
* Test method calls with the CallMethodRule rule. It should be possible
* to call a method with no arguments using several rule syntaxes.
*/
+ @Test
public void testBasic() throws SAXException, IOException {
// Configure the digester as required
@@ -133,6 +113,7 @@ public class CallMethodRuleTestCase exte
* Test method calls with the CallMethodRule reading from the element
* body, with no CallParamMethod rules added.
*/
+ @Test
public void testCallMethodOnly() throws Exception {
// Configure the digester as required
@@ -156,6 +137,7 @@ public class CallMethodRuleTestCase exte
* parameters to target methods. String, int, boolean, float should all
* be acceptable as parameter types.
*/
+ @Test
public void testSettingProperties() throws SAXException, IOException {
// Configure the digester as required
@@ -228,6 +210,7 @@ public class CallMethodRuleTestCase exte
* This tests the call methods params enhancement that provides
* for more complex stack-based calls.
*/
+ @Test
public void testParamsFromStack() throws SAXException, IOException {
StringBuffer xml = new StringBuffer().
@@ -265,6 +248,7 @@ public class CallMethodRuleTestCase exte
* The current implementation of CallMethodRule ensures this works by
* firing only at the end of the tag that CallMethodRule triggered on.
*/
+ @Test
public void testOrderNestedPartA() throws Exception {
// Configure the digester as required
@@ -310,6 +294,7 @@ public class CallMethodRuleTestCase exte
* behaved, and it is expected that apps out there rely on this call order
* so this test is present to ensure that no-one changes this behaviour.
*/
+ @Test
public void testOrderNestedPartB() throws Exception {
// Configure the digester as required
@@ -332,6 +317,7 @@ public class CallMethodRuleTestCase exte
assertEquals("Wrong method call order", "CBA", word.toString());
}
+ @Test
public void testPrimitiveReading() throws Exception {
StringReader reader = new StringReader(
"<?xml version='1.0' ?><root><bean good='true'/><bean good='false'/><bean/>"
@@ -381,7 +367,8 @@ public class CallMethodRuleTestCase exte
assertTrue("Bean 5 property not called", bean.getSetBooleanCalled());
assertEquals("Bean 5 property incorrect", false, bean.getBoolean());
}
-
+
+ @Test
public void testFromStack() throws Exception {
StringReader reader = new StringReader(
@@ -440,7 +427,8 @@ public class CallMethodRuleTestCase exte
bean = list.get(4);
assertEquals("Out of stack not set to null", null , bean.getName());
}
-
+
+ @Test
public void testTwoCalls() throws Exception {
@@ -482,6 +470,7 @@ public class CallMethodRuleTestCase exte
assertEquals("That wrong (3)", "90", bean.getThat());
}
+ @Test
public void testNestedBody() throws Exception {
StringReader reader = new StringReader(
@@ -534,7 +523,8 @@ public class CallMethodRuleTestCase exte
bean = list.get(1);
assertEquals("Wrong name (5)", "Deepest", bean.getName());
}
-
+
+ @Test
public void testProcessingHook() throws Exception {
class TestCallMethodRule extends CallMethodRule {
@@ -575,6 +565,7 @@ public class CallMethodRuleTestCase exte
}
/** Test for the PathCallParamRule */
+ @Test
public void testPathCallParam() throws Exception {
String xml = "<?xml version='1.0'?><main>"
+ "<alpha><beta>Ignore this</beta></alpha>"
@@ -603,6 +594,7 @@ public class CallMethodRuleTestCase exte
/**
* Test invoking an object which does not exist on the stack.
*/
+ @Test
public void testCallInvalidTarget() throws Exception {
Digester digester = new Digester();
@@ -627,6 +619,7 @@ public class CallMethodRuleTestCase exte
* Test invoking an object which is at top-1 on the stack, like
* SetNextRule does...
*/
+ @Test
public void testCallNext() throws Exception {
Digester digester = new Digester();
@@ -656,6 +649,7 @@ public class CallMethodRuleTestCase exte
* Test invoking an object which is at the root of the stack, like
* SetRoot does...
*/
+ @Test
public void testCallRoot() throws Exception {
Digester digester = new Digester();
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java Wed Sep 1 18:15:22 2010
@@ -19,6 +19,14 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.InputStream;
import java.io.Reader;
@@ -29,10 +37,9 @@ import java.util.ArrayList;
import java.util.EmptyStackException;
import java.util.Map;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.AttributesImpl;
@@ -47,7 +54,7 @@ import org.xml.sax.helpers.AttributesImp
* @version $Revision$ $Date$
*/
-public class DigesterTestCase extends TestCase {
+public class DigesterTestCase {
// ----------------------------------------------------- Instance Variables
@@ -72,28 +79,13 @@ public class DigesterTestCase extends Te
};
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public DigesterTestCase(String name) {
-
- super(name);
-
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -103,19 +95,9 @@ public class DigesterTestCase extends Te
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(DigesterTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -131,6 +113,7 @@ public class DigesterTestCase extends Te
* Test <code>null</code> parsing.
* (should lead to <code>IllegalArgumentException</code>s)
*/
+ @Test
public void testNullFileParse() throws Exception {
try {
@@ -142,6 +125,7 @@ public class DigesterTestCase extends Te
}
+ @Test
public void testNullInputSourceParse() throws Exception {
try {
@@ -153,6 +137,7 @@ public class DigesterTestCase extends Te
}
+ @Test
public void testNullInputStreamParse() throws Exception {
try {
@@ -164,6 +149,7 @@ public class DigesterTestCase extends Te
}
+ @Test
public void testNullReaderParse() throws Exception {
try {
@@ -175,6 +161,7 @@ public class DigesterTestCase extends Te
}
+ @Test
public void testNullStringParse() throws Exception {
try {
@@ -186,6 +173,7 @@ public class DigesterTestCase extends Te
}
+ @Test
public void testNullURLParse() throws Exception {
try {
@@ -201,6 +189,7 @@ public class DigesterTestCase extends Te
/**
* Test the basic property getters and setters.
*/
+ @Test
public void testProperties() {
assertNull("Initial error handler is null",
@@ -236,6 +225,7 @@ public class DigesterTestCase extends Te
/**
* Test registration of URLs for specified public identifiers.
*/
+ @Test
public void testRegistrations() {
Map<String, URL> map = digester.getRegistrations();
@@ -272,6 +262,7 @@ public class DigesterTestCase extends Te
/**
* Basic test for rule creation and matching.
*/
+ @Test
public void testRules() {
assertEquals("Initial rules list is empty",
@@ -302,6 +293,7 @@ public class DigesterTestCase extends Te
* <li>longest pattern rule</li>
* </ul>
*/
+ @Test
public void testRulesBase() {
assertEquals("Initial rules list is empty",
@@ -339,6 +331,7 @@ public class DigesterTestCase extends Te
/**
* Test the basic stack mechanisms.
*/
+ @Test
public void testStackMethods() {
Object value = null;
@@ -383,6 +376,7 @@ public class DigesterTestCase extends Te
}
+ @Test
public void testOnceAndOnceOnly() throws Exception {
class TestConfigureDigester extends Digester {
@@ -402,7 +396,8 @@ public class DigesterTestCase extends Te
assertEquals("Initialize should be called once and only once", 1, digester.called);
}
-
+
+ @Test
public void testBasicSubstitution() throws Exception {
class TestSubRule extends Rule {
public String body;
@@ -459,6 +454,7 @@ public class DigesterTestCase extends Te
}
/** Tests the push-peek-pop cycle for a named stack */
+ @Test
public void testNamedStackPushPeekPop() throws Exception
{
BigDecimal archimedesAveragePi = new BigDecimal("3.1418");
@@ -497,6 +493,7 @@ public class DigesterTestCase extends Te
}
/** Tests that values are stored independently */
+ @Test
public void testNamedIndependence()
{
String testStackOneName = "org.apache.commons.digester.tests.testNamedIndependenceOne";
@@ -509,6 +506,7 @@ public class DigesterTestCase extends Te
}
/** Tests popping named stack not yet pushed */
+ @Test
public void testPopNamedStackNotPushed()
{
String testStackName = "org.apache.commons.digester.tests.testPopNamedStackNotPushed";
@@ -533,6 +531,7 @@ public class DigesterTestCase extends Te
}
/** Tests for isEmpty */
+ @Test
public void testNamedStackIsEmpty()
{
String testStackName = "org.apache.commons.digester.tests.testNamedStackIsEmpty";
@@ -560,6 +559,7 @@ public class DigesterTestCase extends Te
/**
* Test the Digester.getRoot method.
*/
+ @Test
public void testGetRoot() throws Exception {
Digester digester = new Digester();
digester.addRule("root", new ObjectCreateRule(TestBean.class));
@@ -603,6 +603,7 @@ public class DigesterTestCase extends Te
/**
* Test custom StackAction subclasses.
*/
+ @Test
public void testStackAction() {
TrackingStackAction action = new TrackingStackAction();
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/EBRTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/EBRTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/EBRTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/EBRTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,11 +20,12 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+
import java.util.Iterator;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.Test;
/**
@@ -38,19 +39,6 @@ import junit.framework.TestSuite;
public class EBRTestCase extends RulesBaseTestCase {
- // ----------------------------------------------------------- Constructors
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public EBRTestCase(String name) {
-
- super(name);
- }
-
-
// -------------------------------------------------- Overall Test Methods
/**
@@ -66,21 +54,12 @@ public class EBRTestCase extends RulesBa
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(EBRTestCase.class));
-
- }
-
-
- /**
* Basic test of parent matching rules.
* A parent match matches any child of a particular kind of parent.
* A wild parent has a wildcard prefix.
* This method tests non-universal wildcards.
*/
+ @Test
public void testBasicParentMatch() {
// clear any existing rules
@@ -151,6 +130,7 @@ public class EBRTestCase extends RulesBa
* Basic test of universal matching rules.
* Universal rules act independent.
*/
+ @Test
public void testBasicUniversal() {
// clear any existing rules
@@ -235,6 +215,7 @@ public class EBRTestCase extends RulesBa
* A non-universal will match matches anything not matched by something else.
* This method tests non-universal and universal wild matches.
*/
+ @Test
public void testWildMatch() {
// clear any existing rules
@@ -299,6 +280,7 @@ public class EBRTestCase extends RulesBa
* A non-universal will match matches anything not matched by something else.
* This method tests non-universal and universal wild matches.
*/
+ @Test
public void testRootTailMatch() {
// clear any existing rules
@@ -341,7 +323,8 @@ public class EBRTestCase extends RulesBa
digester.getRules().clear();
}
-
+
+ @Test
public void testAncesterMatch() throws Exception {
// test fixed root ancester
digester.getRules().clear();
@@ -401,7 +384,8 @@ public class EBRTestCase extends RulesBa
assertEquals("Wild ancester match (2)", 1, list.size());
assertEquals("Match missed (5)", "star-b-c-star" , ((TestRule) list.get(0)).getIdentifier());
}
-
+
+ @Test
public void testLongMatch() {
digester.getRules().clear();
@@ -423,7 +407,8 @@ public class EBRTestCase extends RulesBa
list = digester.getRules().match(null, "a/b/c/d");
assertEquals("Long match (4)", 0, list.size());
}
-
+
+ @Test
public void testInstructors() {
digester.getRules().clear();
@@ -435,7 +420,8 @@ public class EBRTestCase extends RulesBa
assertEquals("Instructors expected", "instructors" , ((TestRule) list.get(0)).getIdentifier());
}
-
+
+ @Test
public void testMiddleInstructors() {
digester.getRules().clear();
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,13 +20,15 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.io.StringReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.xml.sax.Locator;
@@ -35,7 +37,7 @@ import org.xml.sax.Locator;
* of objects created from input xml stream.
*/
-public class LocationTrackerTestCase extends TestCase {
+public class LocationTrackerTestCase {
private static class LocationTracker implements StackAction {
public Map<Object, String> locations = new HashMap<Object, String>();
@@ -60,6 +62,7 @@ public class LocationTrackerTestCase ext
}
}
+ @Test
public void testAll() throws Exception {
final String TEST_XML =
"<?xml version='1.0'?>\n"
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/NamespaceSnapshotTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/NamespaceSnapshotTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/NamespaceSnapshotTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/NamespaceSnapshotTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,13 +20,15 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.xml.sax.Attributes;
@@ -34,7 +36,7 @@ import org.xml.sax.Attributes;
* Tests namespace snapshotting.
*/
-public class NamespaceSnapshotTestCase extends TestCase {
+public class NamespaceSnapshotTestCase {
/**
* A test case specific helper rule.
@@ -55,6 +57,7 @@ public class NamespaceSnapshotTestCase e
/**
* Namespace snapshot test case.
*/
+ @Test
public void testNamespaceSnapshots() throws Exception {
Digester digester = new Digester();
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/NodeCreateRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/NodeCreateRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/NodeCreateRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/NodeCreateRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,6 +20,8 @@
package org.apache.commons.digester;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
@@ -30,10 +32,9 @@ import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
@@ -48,7 +49,7 @@ import org.xml.sax.SAXException;
* @version $Revision$ $Date$
*/
-public class NodeCreateRuleTestCase extends TestCase {
+public class NodeCreateRuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -67,28 +68,13 @@ public class NodeCreateRuleTestCase exte
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public NodeCreateRuleTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -97,19 +83,9 @@ public class NodeCreateRuleTestCase exte
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(NodeCreateRuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -125,6 +101,7 @@ public class NodeCreateRuleTestCase exte
* Tests simple element construction, using the {@link #TEST_XML}
* XML input data.
*/
+ @Test
public void testInvalidNodeTypes() throws Exception {
try {
@@ -208,6 +185,7 @@ public class NodeCreateRuleTestCase exte
* Tests simple element construction, using the {@link #TEST_XML}
* XML input data.
*/
+ @Test
public void testElement()
throws SAXException, ParserConfigurationException, IOException {
@@ -230,6 +208,7 @@ public class NodeCreateRuleTestCase exte
* Tests simple fragment construction, using the {@link #TEST_XML}
* XML input data.
*/
+ @Test
public void testDocumentFragment()
throws SAXException, ParserConfigurationException, IOException {
@@ -277,6 +256,7 @@ public class NodeCreateRuleTestCase exte
* Tests whether control is returned to digester after fragment
* construction.
*/
+ @Test
public void testNested()
throws SAXException, ParserConfigurationException, IOException {
@@ -312,6 +292,7 @@ public class NodeCreateRuleTestCase exte
* Tests whether attributes are correctly imported into the fragment, using
* the example in the Test1 XML file.
*/
+ @Test
public void testAttributes()
throws SAXException, ParserConfigurationException, IOException {
@@ -351,6 +332,7 @@ public class NodeCreateRuleTestCase exte
* Tests whether namespaces are handled correctly, using the example from
* the file Test3 XML file.
*/
+ @Test
public void testNamespaces()
throws SAXException, ParserConfigurationException, IOException {
@@ -397,6 +379,7 @@ public class NodeCreateRuleTestCase exte
* Tests whether namespaced attributes are handled correctly, using the example from
* the file Test10 XML file.
*/
+ @Test
public void testNamespacedAttribute()
throws SAXException, ParserConfigurationException, IOException {
@@ -422,6 +405,7 @@ public class NodeCreateRuleTestCase exte
* Tests whether non-namespaced attributes are handled correctly, using the example from
* the file Test11 XML file.
*/
+ @Test
public void testNonNamespacedAttribute()
throws SAXException, ParserConfigurationException, IOException {
@@ -447,6 +431,7 @@ public class NodeCreateRuleTestCase exte
* Tests whether the created fragment can be imported into an existing
* document.
*/
+ @Test
public void testImport()
throws SAXException, ParserConfigurationException, IOException {
@@ -470,6 +455,7 @@ public class NodeCreateRuleTestCase exte
* parser to make multiple invocations of the characters(..) sax
* callback, rather than just one.
*/
+ @Test
public void testEntityText() throws Exception {
String TEST_XML2 =
"<?xml version='1.0'?><root><alpha>A A</alpha></root>";
Copied: commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectCreationFactoryTestImpl.java (from r990027, commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestObjectCreationFactory.java)
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectCreationFactoryTestImpl.java?p2=commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectCreationFactoryTestImpl.java&p1=commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestObjectCreationFactory.java&r1=990027&r2=991633&rev=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestObjectCreationFactory.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectCreationFactoryTestImpl.java Wed Sep 1 18:15:22 2010
@@ -28,7 +28,7 @@ import org.xml.sax.helpers.AttributesImp
* @author Robert Burrell Donkin
*/
-public class TestObjectCreationFactory extends AbstractObjectCreationFactory {
+public class ObjectCreationFactoryTestImpl extends AbstractObjectCreationFactory {
public boolean called = false;
public Attributes attributes;
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectParamRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectParamRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectParamRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/ObjectParamRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,14 +20,17 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
@@ -36,7 +39,7 @@ import org.xml.sax.SAXException;
*
* @author Mark Huisman
*/
-public class ObjectParamRuleTestCase extends TestCase {
+public class ObjectParamRuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -48,36 +51,13 @@ public class ObjectParamRuleTestCase ext
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public ObjectParamRuleTestCase(String name) {
-
- super(name);
-
- }
-
-
- public static void main(String[] args){
-
- // so we can run standalone
- junit.textui.TestRunner.run(suite());
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -86,19 +66,9 @@ public class ObjectParamRuleTestCase ext
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(ObjectParamRuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -118,6 +88,7 @@ public class ObjectParamRuleTestCase ext
* pass any subclass of Object as a parameter, provided that either the element
* or the element + attribute has been matched.
*/
+ @Test
public void testBasic() throws SAXException, IOException {
// Configure the digester as required
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/OtherTestObjectCreationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/OtherTestObjectCreationFactory.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/OtherTestObjectCreationFactory.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/OtherTestObjectCreationFactory.java Wed Sep 1 18:15:22 2010
@@ -26,7 +26,7 @@ package org.apache.commons.digester;
* @author Robert Burrell Donkin
*/
-public class OtherTestObjectCreationFactory extends TestObjectCreationFactory {}
+public class OtherTestObjectCreationFactory extends ObjectCreationFactoryTestImpl {}
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/OverlappingCallMethodRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/OverlappingCallMethodRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/OverlappingCallMethodRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/OverlappingCallMethodRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -19,64 +19,23 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+
import java.io.IOException;
import java.io.StringReader;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
* <p>Tests for situations where CallMethodRule instances and their
* parameters overlap each other.</p>
*/
-public class OverlappingCallMethodRuleTestCase extends TestCase {
-
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public OverlappingCallMethodRuleTestCase(String name) {
-
- super(name);
-
- }
+public class OverlappingCallMethodRuleTestCase {
// --------------------------------------------------- Overall Test Methods
-
- /**
- * Set up instance variables required by this test case.
- */
- @Override
- public void setUp() {
- }
-
-
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
- return (new TestSuite(OverlappingCallMethodRuleTestCase.class));
- }
-
-
- /**
- * Tear down instance variables required by this test case.
- */
- @Override
- public void tearDown() {
- }
-
-
-
String itemId;
String itemName;
@@ -85,7 +44,7 @@ public class OverlappingCallMethodRuleTe
// ------------------------------------------------ Individual Test Methods
-
+ @Test
public void testItem1() throws SAXException, IOException {
StringBuffer input = new StringBuffer();
input.append("<root>");
@@ -108,6 +67,7 @@ public class OverlappingCallMethodRuleTe
assertEquals("anitem", this.itemName);
}
+ @Test
public void testItem2() throws SAXException, IOException {
StringBuffer input = new StringBuffer();
input.append("<root>");
@@ -130,6 +90,7 @@ public class OverlappingCallMethodRuleTe
assertEquals("anitem", this.itemName);
}
+ @Test
public void testItem3() throws SAXException, IOException {
StringBuffer input = new StringBuffer();
input.append("<root>");
@@ -173,7 +134,7 @@ public class OverlappingCallMethodRuleTe
* patterns which cause a rule to fire in a "recursive" manner. However
* implementing this is not possible with the current digester design.
*/
-
+ @Test
public void testItem4() throws SAXException, IOException {
StringBuffer input = new StringBuffer();
input.append("<root>");
@@ -210,6 +171,7 @@ public class OverlappingCallMethodRuleTe
* ie a rule instances' methods gets called in the order
* begin[1]/begin[2]/body[2]/end[2]/body[1]/end[1]
*/
+ @Test
public void testWildcard1() throws SAXException, IOException {
StringBuffer input = new StringBuffer();
input.append("<box id='A1'>");
@@ -242,6 +204,7 @@ public class OverlappingCallMethodRuleTe
* ie a rule instances' methods gets called in the order
* begin[1]/begin[2]/body[2]/end[2]/body[1]/end[1]
*/
+ @Test
public void testWildcard2() throws SAXException, IOException {
StringBuffer input = new StringBuffer();
input.append("<box>A1");
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/RegexRulesTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/RegexRulesTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/RegexRulesTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/RegexRulesTestCase.java Wed Sep 1 18:15:22 2010
@@ -18,9 +18,11 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Test;
/**
* Test case for RegexRules
@@ -29,14 +31,10 @@ import junit.framework.TestCase;
* @version $Revision$ $Date$
*/
-public class RegexRulesTestCase extends TestCase {
-
- /** Base constructor */
- public RegexRulesTestCase(String name) {
- super(name);
- }
+public class RegexRulesTestCase {
/** Test regex that matches everything */
+ @Test
public void testMatchAll() {
// set up which should match every rule
RegexRules rules = new RegexRules(
@@ -67,6 +65,7 @@ public class RegexRulesTestCase extends
}
/** Test regex matcher that matches nothing */
+ @Test
public void testMatchNothing() {
// set up which should match every rule
RegexRules rules = new RegexRules(
@@ -91,6 +90,7 @@ public class RegexRulesTestCase extends
}
/** Test a mixed regex - in other words, one that sometimes returns true and sometimes false */
+ @Test
public void testMatchMixed() {
// set up which should match every rule
RegexRules rules = new RegexRules(
@@ -116,6 +116,7 @@ public class RegexRulesTestCase extends
}
/** Test rules and clear methods */
+ @Test
public void testClear() {
// set up which should match every rule
RegexRules rules = new RegexRules(
@@ -150,7 +151,8 @@ public class RegexRulesTestCase extends
matches = rules.match("", "/eggs");
assertEquals("Wrong number of rules returned (4)", 0, matches.size());
}
-
+
+ @Test
public void testSimpleRegexMatch() {
SimpleRegexMatcher matcher = new SimpleRegexMatcher();
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/RuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/RuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/RuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/RuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,14 +20,19 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
@@ -39,7 +44,7 @@ import org.xml.sax.SAXException;
* @version $Revision$ $Date$
*/
-public class RuleTestCase extends TestCase {
+public class RuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -51,28 +56,13 @@ public class RuleTestCase extends TestCa
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public RuleTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -81,19 +71,9 @@ public class RuleTestCase extends TestCa
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(RuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -110,6 +90,7 @@ public class RuleTestCase extends TestCa
* the stack, which should cause an appropriate Employee object to be
* returned.
*/
+ @Test
public void testObjectCreate1() throws SAXException, IOException {
// Configure the digester as required
@@ -142,6 +123,7 @@ public class RuleTestCase extends TestCa
* returned. The processing rules will process the nested Address elements
* as well, but will not attempt to add them to the Employee.
*/
+ @Test
public void testObjectCreate2() throws SAXException, IOException {
// Configure the digester as required
@@ -176,6 +158,7 @@ public class RuleTestCase extends TestCa
* returned. The processing rules will process the nested Address elements
* as well, and will add them to the owning Employee.
*/
+ @Test
public void testObjectCreate3() throws SAXException, IOException {
// Configure the digester as required
@@ -208,6 +191,7 @@ public class RuleTestCase extends TestCa
* Same as testObjectCreate1(), except use individual call method rules
* to set the properties of the Employee.
*/
+ @Test
public void testObjectCreate4() throws SAXException, IOException {
// Configure the digester as required
@@ -245,6 +229,7 @@ public class RuleTestCase extends TestCa
* a paramCount=0 (ie the body of the element is the argument of the
* method).
*/
+ @Test
public void testObjectCreate5() throws SAXException, IOException {
// Configure the digester as required
@@ -275,6 +260,7 @@ public class RuleTestCase extends TestCa
* It should be possible to parse the same input twice, and get trees
* of objects that are isomorphic but not be identical object instances.
*/
+ @Test
public void testRepeatedParse() throws SAXException, IOException {
// Configure the digester as required
@@ -311,6 +297,7 @@ public class RuleTestCase extends TestCa
* returned. The processing rules will process the nested Address elements
* as well, but will not attempt to add them to the Employee.
*/
+ @Test
public void testRuleSet1() throws SAXException, IOException {
// Configure the digester as required
@@ -342,6 +329,7 @@ public class RuleTestCase extends TestCa
/**
* Same as <code>testRuleSet1</code> except using a single namespace.
*/
+ @Test
public void testRuleSet2() throws SAXException, IOException {
// Configure the digester as required
@@ -377,6 +365,7 @@ public class RuleTestCase extends TestCa
* for employee that we should recognize, and a namespace for
* address that we should skip.
*/
+ @Test
public void testRuleSet3() throws SAXException, IOException {
// Configure the digester as required
@@ -417,6 +406,7 @@ public class RuleTestCase extends TestCa
* with the top-1 (parent) object as an argument. The three argument
* form is tested in <code>testSetTopRule2</code>.
*/
+ @Test
public void testSetTopRule1() throws SAXException, IOException {
// Configure the digester as required
@@ -440,6 +430,7 @@ public class RuleTestCase extends TestCa
* Same as <code>testSetTopRule1</code> except using the three argument
* form of the SetTopRule rule.
*/
+ @Test
public void testSetTopRule2() throws SAXException, IOException {
// Configure the digester as required
@@ -464,6 +455,7 @@ public class RuleTestCase extends TestCa
* Test rule addition - this boils down to making sure that
* digester is set properly on rule addition.
*/
+ @Test
public void testAddRule() {
Digester digester = new Digester();
TestRule rule = new TestRule("Test");
@@ -474,7 +466,7 @@ public class RuleTestCase extends TestCa
}
-
+ @Test
public void testSetNext() throws SAXException, IOException {
Digester digester = new Digester();
digester.setRules(new ExtendedBaseRules());
@@ -507,7 +499,7 @@ public class RuleTestCase extends TestCa
}
-
+ @Test
public void testSetTop() throws SAXException, IOException {
Digester digester = new Digester();
digester.setRules(new ExtendedBaseRules());
@@ -555,6 +547,7 @@ public class RuleTestCase extends TestCa
/**
*/
+ @Test
public void testSetCustomProperties() throws SAXException, IOException {
Digester digester = new Digester();
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/RulesBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/RulesBaseTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/RulesBaseTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/RulesBaseTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,12 +20,14 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+
import java.util.Iterator;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
@@ -39,7 +41,7 @@ import junit.framework.TestSuite;
* @version $Revision$ $Date$
*/
-public class RulesBaseTestCase extends TestCase {
+public class RulesBaseTestCase {
// ----------------------------------------------------- Instance Variables
@@ -50,20 +52,6 @@ public class RulesBaseTestCase extends T
*/
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public RulesBaseTestCase(String name) {
-
- super(name);
-
- }
-
// -------------------------------------------------- Overall Test Methods
@@ -71,7 +59,7 @@ public class RulesBaseTestCase extends T
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -88,20 +76,11 @@ public class RulesBaseTestCase extends T
return new RulesBase();
}
- /**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(RulesBaseTestCase.class));
-
- }
-
/**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -115,6 +94,7 @@ public class RulesBaseTestCase extends T
/**
* Basic test for rule creation and matching.
*/
+ @Test
public void testRules() {
// clear any existing rules
@@ -152,6 +132,7 @@ public class RulesBaseTestCase extends T
* <li>longest pattern rule</li>
* </ul>
*/
+ @Test
public void testRulesBase() {
// clear any existing rules
@@ -204,6 +185,7 @@ public class RulesBaseTestCase extends T
/**
* Test basic matchings involving namespaces.
*/
+ @Test
public void testBasicNamespaceMatching() {
List<Rule> list = null;
@@ -260,6 +242,7 @@ public class RulesBaseTestCase extends T
/**
* Rules must always be returned in the correct order.
*/
+ @Test
public void testOrdering() {
// clear any existing rules
@@ -289,6 +272,7 @@ public class RulesBaseTestCase extends T
}
/** Tests the behaviour when a rule is added with a trailing slash*/
+ @Test
public void testTrailingSlash() {
// clear any existing rules
digester.getRules().clear();
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetNestedPropertiesRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetNestedPropertiesRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetNestedPropertiesRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetNestedPropertiesRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,14 +20,17 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
@@ -36,7 +39,7 @@ import org.xml.sax.SAXException;
* This contains tests for the main applications of the rule
* and two more general tests of digester functionality used by this rule.
*/
-public class SetNestedPropertiesRuleTestCase extends TestCase {
+public class SetNestedPropertiesRuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -60,28 +63,13 @@ public class SetNestedPropertiesRuleTest
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public SetNestedPropertiesRuleTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -90,19 +78,9 @@ public class SetNestedPropertiesRuleTest
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(SetNestedPropertiesRuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -117,6 +95,7 @@ public class SetNestedPropertiesRuleTest
/**
* Test that you can successfully automatically set properties.
*/
+ @Test
public void testAutomaticallySetProperties()
throws SAXException, IOException {
@@ -155,6 +134,7 @@ public class SetNestedPropertiesRuleTest
* Test that it is an error when a child element exists but no corresponding
* java property exists.
*/
+ @Test
public void testMandatoryProperties()
throws SAXException, IOException {
@@ -193,6 +173,7 @@ public class SetNestedPropertiesRuleTest
* Test that you can customise the property mappings using the
* constructor which takes arrays-of-strings.
*/
+ @Test
public void testCustomisedProperties1()
throws SAXException, IOException {
@@ -254,6 +235,7 @@ public class SetNestedPropertiesRuleTest
* Test that you can ignore a single input xml element using the
* constructor which takes a single remapping.
*/
+ @Test
public void testCustomisedProperties2a()
throws SAXException, IOException {
@@ -308,6 +290,7 @@ public class SetNestedPropertiesRuleTest
* Test that you can customise the property mappings using the
* constructor which takes a single remapping.
*/
+ @Test
public void testCustomisedProperties2b()
throws SAXException, IOException {
@@ -368,6 +351,7 @@ public class SetNestedPropertiesRuleTest
* <li> the Rules object is reset nicely. </li>
* </ul>
*/
+ @Test
public void testMultiRuleMatch()
throws SAXException, IOException {
@@ -427,6 +411,7 @@ public class SetNestedPropertiesRuleTest
/**
* Test that unknown child elements trigger an exception.
*/
+ @Test
public void testUnknownChildrenCausesException()
throws SAXException, IOException {
@@ -465,6 +450,7 @@ public class SetNestedPropertiesRuleTest
* Test that unknown child elements are allowed if the appropriate
* flag is set.
*/
+ @Test
public void testUnknownChildrenExceptionOverride()
throws SAXException, IOException {
@@ -497,6 +483,7 @@ public class SetNestedPropertiesRuleTest
* <p>
* See bugzilla entry 31393.
*/
+ @Test
public void testRecursiveNestedProperties()
throws SAXException, IOException {
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertiesRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertiesRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertiesRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertiesRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,20 +20,24 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
import java.io.Reader;
import java.io.StringReader;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
* <p> Test case for <code>SetPropertiesRule</code>.</p>
*/
-public class SetPropertiesRuleTestCase extends TestCase {
+public class SetPropertiesRuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -62,28 +66,13 @@ public class SetPropertiesRuleTestCase e
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public SetPropertiesRuleTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -92,19 +81,9 @@ public class SetPropertiesRuleTestCase e
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(SetPropertiesRuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -119,6 +98,7 @@ public class SetPropertiesRuleTestCase e
/**
* Positive test for SetPropertiesRule.
*/
+ @Test
public void testPositive() throws Exception {
// Set up the rules we need
@@ -148,6 +128,7 @@ public class SetPropertiesRuleTestCase e
/**
* Positive test for SetPropertyRule ignoring missing properties.
*/
+ @Test
public void testIgnoreMissing() throws Exception {
// Set up the rules we need
@@ -176,6 +157,7 @@ public class SetPropertiesRuleTestCase e
/**
* Negative test for SetPropertyRule ignoring missing properties.
*/
+ @Test
public void testNegativeNotIgnoreMissing() throws Exception {
// Set up the rules we need
@@ -215,6 +197,7 @@ public class SetPropertiesRuleTestCase e
/**
* Negative test for SetPropertyRule ignoring missing properties.
*/
+ @Test
public void testPositiveNotIgnoreMissingWithIgnoreAttributes() throws Exception {
// Set up the rules we need
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertyRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertyRuleTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertyRuleTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/SetPropertyRuleTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,21 +20,25 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
/**
* <p> Test case for <code>SetPropertyRule</code>.</p>
*/
-public class SetPropertyRuleTestCase extends TestCase {
+public class SetPropertyRuleTestCase {
// ----------------------------------------------------- Instance Variables
@@ -64,28 +68,13 @@ public class SetPropertyRuleTestCase ext
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public SetPropertyRuleTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -94,19 +83,9 @@ public class SetPropertyRuleTestCase ext
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(SetPropertyRuleTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -121,6 +100,7 @@ public class SetPropertyRuleTestCase ext
/**
* Positive test for SetPropertyRule.
*/
+ @Test
public void testPositive() throws Exception {
// Set up the rules we need
@@ -151,6 +131,7 @@ public class SetPropertyRuleTestCase ext
/**
* Negative test for SetPropertyRule.
*/
+ @Test
public void testNegative() {
// Set up the rules we need
@@ -206,6 +187,7 @@ public class SetPropertyRuleTestCase ext
* Test SetPropertyRule when matched XML element has no attributes.
* See: DIGESTER-114
*/
+ @Test
public void testElementWithNoAttributes() throws Exception {
String TEST_XML_3 = "<?xml version='1.0'?><root><set/></root>";
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestEntityResolution.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestEntityResolution.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestEntityResolution.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestEntityResolution.java Wed Sep 1 18:15:22 2010
@@ -24,17 +24,17 @@ import java.io.File;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.junit.Test;
import org.xml.sax.helpers.DefaultHandler;
-import junit.framework.TestCase;
-
/**
* Tests for entity resolution.
* @author <a href='http://commons.apache.org/'>Apache Commons Team</a>
* @version $Revision$
*/
-public class TestEntityResolution extends TestCase {
-
+public class TestEntityResolution {
+
+ @Test
public void testParserResolveRelative() throws Exception {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
@@ -45,7 +45,8 @@ public class TestEntityResolution extend
new File("src/test/org/apache/commons/digester/document-with-relative-dtd.xml"),
new DefaultHandler());
}
-
+
+ @Test
public void testDigesterResolveRelative() throws Exception {
Digester digester = new Digester();
digester.setValidating(true);
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestFactoryCreate.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestFactoryCreate.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestFactoryCreate.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/TestFactoryCreate.java Wed Sep 1 18:15:22 2010
@@ -19,14 +19,14 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.Test;
import org.xml.sax.Attributes;
/**
@@ -35,31 +35,12 @@ import org.xml.sax.Attributes;
* @author Robert Burrell Donkin
*/
-public class TestFactoryCreate extends TestCase {
- /** Standard constructor */
- public TestFactoryCreate(String name) {
- super(name);
- }
-
- /** Set up instance variables required by this test case. */
- @Override
- public void setUp() {}
-
- /** Return the tests included in this test suite. */
- public static Test suite() {
-
- return (new TestSuite(TestFactoryCreate.class));
-
- }
-
- /** Tear down instance variables required by this test case.*/
- @Override
- public void tearDown() {}
+public class TestFactoryCreate {
// --------------------------------------------------------------- Test cases
-
+ @Test
public void testPropagateException() throws Exception {
// only used with this method
@@ -110,7 +91,8 @@ public class TestFactoryCreate extends T
fail("Exception should not be propagated");
}
}
-
+
+ @Test
public void testFactoryCreateRule() throws Exception {
tryVariations(true);
tryVariations(false);
@@ -121,7 +103,7 @@ public class TestFactoryCreate extends T
// test passing object create
Digester digester = new Digester();
- TestObjectCreationFactory factory = new TestObjectCreationFactory();
+ ObjectCreationFactoryTestImpl factory = new ObjectCreationFactoryTestImpl();
digester.addFactoryCreate("root", factory, propagateExceptions);
String xml = new String (
"<?xml version='1.0' ?><root one='good' two='bad' three='ugly'><element/></root>");
@@ -144,12 +126,12 @@ public class TestFactoryCreate extends T
digester = new Digester();
digester.addFactoryCreate(
"root",
- "org.apache.commons.digester.TestObjectCreationFactory",
+ "org.apache.commons.digester.ObjectCreationFactoryTestImpl",
propagateExceptions);
digester.addSetNext("root", "add");
xml = new String (
"<?xml version='1.0' ?><root one='good' two='bad' three='ugly'><element/></root>");
- List<TestObjectCreationFactory> list = new ArrayList<TestObjectCreationFactory>();
+ List<ObjectCreationFactoryTestImpl> list = new ArrayList<ObjectCreationFactoryTestImpl>();
digester.push(list);
digester.parse(new StringReader(xml));
@@ -173,13 +155,13 @@ public class TestFactoryCreate extends T
digester = new Digester();
digester.addFactoryCreate(
"root",
- "org.apache.commons.digester.TestObjectCreationFactory",
+ "org.apache.commons.digester.ObjectCreationFactoryTestImpl",
"override",
propagateExceptions);
digester.addSetNext("root", "add");
xml = new String (
"<?xml version='1.0' ?><root one='good' two='bad' three='ugly'><element/></root>");
- list = new ArrayList<TestObjectCreationFactory>();
+ list = new ArrayList<ObjectCreationFactoryTestImpl>();
digester.push(list);
digester.parse(new StringReader(xml));
@@ -202,7 +184,7 @@ public class TestFactoryCreate extends T
digester = new Digester();
digester.addFactoryCreate(
"root",
- "org.apache.commons.digester.TestObjectCreationFactory",
+ "org.apache.commons.digester.ObjectCreationFactoryTestImpl",
"override",
propagateExceptions);
digester.addSetNext("root", "add");
@@ -210,7 +192,7 @@ public class TestFactoryCreate extends T
"<?xml version='1.0' ?><root one='good' two='bad' three='ugly' "
+ " override='org.apache.commons.digester.OtherTestObjectCreationFactory' >"
+ "<element/></root>");
- list = new ArrayList<TestObjectCreationFactory>();
+ list = new ArrayList<ObjectCreationFactoryTestImpl>();
digester.push(list);
digester.parse(new StringReader(xml));
@@ -237,13 +219,13 @@ public class TestFactoryCreate extends T
digester = new Digester();
digester.addFactoryCreate(
"root",
- TestObjectCreationFactory.class,
+ ObjectCreationFactoryTestImpl.class,
"override",
propagateExceptions);
digester.addSetNext("root", "add");
xml = new String (
"<?xml version='1.0' ?><root one='good' two='bad' three='ugly'><element/></root>");
- list = new ArrayList<TestObjectCreationFactory>();
+ list = new ArrayList<ObjectCreationFactoryTestImpl>();
digester.push(list);
digester.parse(new StringReader(xml));
@@ -266,7 +248,7 @@ public class TestFactoryCreate extends T
digester = new Digester();
digester.addFactoryCreate(
"root",
- TestObjectCreationFactory.class,
+ ObjectCreationFactoryTestImpl.class,
"override",
propagateExceptions);
digester.addSetNext("root", "add");
@@ -274,7 +256,7 @@ public class TestFactoryCreate extends T
"<?xml version='1.0' ?><root one='good' two='bad' three='ugly' "
+ " override='org.apache.commons.digester.OtherTestObjectCreationFactory' >"
+ "<element/></root>");
- list = new ArrayList<TestObjectCreationFactory>();
+ list = new ArrayList<ObjectCreationFactoryTestImpl>();
digester.push(list);
digester.parse(new StringReader(xml));
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/URLTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/URLTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/URLTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/URLTestCase.java Wed Sep 1 18:15:22 2010
@@ -19,31 +19,19 @@
package org.apache.commons.digester;
+import static org.junit.Assert.*;
+
import java.net.URL;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* <p>Unit tests that exercise the new (in 1.8) methods for passing in
* <code>URL</code> arguments instead of strings.</p>
*/
-public class URLTestCase extends TestCase {
-
-
- // ------------------------------------------------------------ Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public URLTestCase(String name) {
-
- super(name);
-
- }
+public class URLTestCase {
// ----------------------------------------------------- Overall Test Methods
@@ -52,7 +40,7 @@ public class URLTestCase extends TestCas
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -61,19 +49,9 @@ public class URLTestCase extends TestCas
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(URLTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -119,6 +97,7 @@ public class URLTestCase extends TestCas
// Test a pristine instance
+ @Test
public void testPristine() {
assertNotNull(digester);
@@ -127,6 +106,7 @@ public class URLTestCase extends TestCas
// Test parsing a resource, using a registered DTD, both passed with URLs
+ @Test
public void testResource() throws Exception {
// Register the Digester Rules DTD
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/WDRulesWrapperTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/WDRulesWrapperTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/WDRulesWrapperTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/WDRulesWrapperTestCase.java Wed Sep 1 18:15:22 2010
@@ -18,9 +18,12 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Test;
/**
* Test case for WithDefaultsRulesWrapper
@@ -29,13 +32,9 @@ import junit.framework.TestCase;
* @version $Revision$ $Date$
*/
-public class WDRulesWrapperTestCase extends TestCase {
-
- /** Base constructor */
- public WDRulesWrapperTestCase(String name) {
- super(name);
- }
-
+public class WDRulesWrapperTestCase {
+
+ @Test
public void testClear() {
// test clear wrapped
WithDefaultsRulesWrapper rules = new WithDefaultsRulesWrapper(new RulesBase());
@@ -62,7 +61,8 @@ public class WDRulesWrapperTestCase exte
rules.clear();
assertEquals("Clear Failed (3)", 0 , rules.rules().size());
}
-
+
+ @Test
public void testRules() {
// test rules
WithDefaultsRulesWrapper rules = new WithDefaultsRulesWrapper(new RulesBase());
@@ -77,7 +77,8 @@ public class WDRulesWrapperTestCase exte
assertEquals("Wrong order (3)", "Roger" , ((TestRule) rules.rules().get(2)).getIdentifier());
assertEquals("Wrong order (4)", "Harry" , ((TestRule) rules.rules().get(3)).getIdentifier());
}
-
+
+ @Test
public void testMatch() {
// test no defaults
WithDefaultsRulesWrapper rules = new WithDefaultsRulesWrapper(new RulesBase());
Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java?rev=991633&r1=991632&r2=991633&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java (original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java Wed Sep 1 18:15:22 2010
@@ -20,13 +20,15 @@
package org.apache.commons.digester;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.io.IOException;
import java.io.InputStream;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.xml.sax.SAXException;
@@ -34,7 +36,7 @@ import org.xml.sax.SAXException;
* <p>Tests for XInclude aware parsing.</p>
*
*/
-public class XIncludeTestCase extends TestCase {
+public class XIncludeTestCase {
// ----------------------------------------------------- Instance Variables
@@ -46,28 +48,13 @@ public class XIncludeTestCase extends Te
protected Digester digester = null;
- // ----------------------------------------------------------- Constructors
-
-
- /**
- * Construct a new instance of this test case.
- *
- * @param name Name of the test case
- */
- public XIncludeTestCase(String name) {
-
- super(name);
-
- }
-
-
// --------------------------------------------------- Overall Test Methods
/**
* Set up instance variables required by this test case.
*/
- @Override
+ @Before
public void setUp() {
digester = new Digester();
@@ -76,19 +63,9 @@ public class XIncludeTestCase extends Te
/**
- * Return the tests included in this test suite.
- */
- public static Test suite() {
-
- return (new TestSuite(XIncludeTestCase.class));
-
- }
-
-
- /**
* Tear down instance variables required by this test case.
*/
- @Override
+ @After
public void tearDown() {
digester = null;
@@ -103,6 +80,7 @@ public class XIncludeTestCase extends Te
/**
* Test XInclude.
*/
+ @Test
public void testXInclude() throws SAXException, IOException {
// Turn on XInclude processing