Author: julien(a)jboss.com
Date: 2007-11-19 10:20:59 -0500 (Mon, 19 Nov 2007)
New Revision: 9024
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/RemoteTestDriverServer.java
modules/test/trunk/unit/pom.xml
modules/test/trunk/unit/src/main/java/org/jboss/unit/Failure.java
modules/test/trunk/unit/src/main/java/org/jboss/unit/FailureType.java
modules/test/trunk/unit/src/main/java/org/jboss/unit/api/Assert.java
modules/test/trunk/unit/src/main/java/org/jboss/unit/runner/model/pojo/POJOTestSuiteDef.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/AllTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/TestIdTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/api/AssertTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/info/InfoTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/AbstractPOJOTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/TestDriverPOJOTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/report/junit/JUnitReporterTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/AbstractTestRunnerTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/CompositeTestRunnerTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/GenericTestRunnerTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/POJOTestRunnerTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/ParametrizationTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/TestDriverRunnerTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerEventBroadcasterSupportTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerLifeCycleFilterTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/model/ModelTests.java
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/sample/SampleTests.java
Log:
enable tests in jboss unit unit module + minor corrections + added test case for array
equality assertion
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/RemoteTestDriverServer.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/RemoteTestDriverServer.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/RemoteTestDriverServer.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -48,7 +48,7 @@
/** . */
private RemoteTestDriver delegate;
- public TestDriver getDelegate()
+ public RemoteTestDriver getDelegate()
{
return delegate;
}
Modified: modules/test/trunk/unit/pom.xml
===================================================================
--- modules/test/trunk/unit/pom.xml 2007-11-19 11:23:25 UTC (rev 9023)
+++ modules/test/trunk/unit/pom.xml 2007-11-19 15:20:59 UTC (rev 9024)
@@ -24,10 +24,24 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <skip>true</skip>
+ <skip>false</skip>
<includes>
+ <include>**/AssertTests.java</include>
<include>**/TestIdTests.java</include>
- <include>**/AllTests.java</include>
+ <include>**/TestDriverPOJOTests.java</include>
+ <include>**/TestHandlerSupportPOJOTests.java</include>
+ <include>**/JUnitPOJOTests.java</include>
+ <include>**/CompositeTestRunnerTests.java</include>
+ <include>**/TestDriverRunnerTests.java</include>
+ <include>**/GenericTestRunnerTests.java</include>
+ <include>**/POJOTestRunnerTests.java</include>
+ <include>**/TestRunnerLifeCycleFilterTests.java</include>
+
<include>**/TestRunnerEventBroadcasterSupportTests.java</include>
+ <include>**/ModelTests.java</include>
+ <include>**/ParametrizationTests.java</include>
+ <include>**/InfoTests.java</include>
+ <include>**/SampleTests.java</include>
+ <!--<include>**/JUnitReporterTests.java</include>-->
</includes>
</configuration>
</plugin>
Modified: modules/test/trunk/unit/src/main/java/org/jboss/unit/Failure.java
===================================================================
--- modules/test/trunk/unit/src/main/java/org/jboss/unit/Failure.java 2007-11-19 11:23:25
UTC (rev 9023)
+++ modules/test/trunk/unit/src/main/java/org/jboss/unit/Failure.java 2007-11-19 15:20:59
UTC (rev 9024)
@@ -22,13 +22,15 @@
******************************************************************************/
package org.jboss.unit;
+import java.io.Serializable;
+
/**
* A failure, contains the description of a failure.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class Failure
+public class Failure implements Serializable
{
/** The optional failure message. */
Modified: modules/test/trunk/unit/src/main/java/org/jboss/unit/FailureType.java
===================================================================
--- modules/test/trunk/unit/src/main/java/org/jboss/unit/FailureType.java 2007-11-19
11:23:25 UTC (rev 9023)
+++ modules/test/trunk/unit/src/main/java/org/jboss/unit/FailureType.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,13 +22,15 @@
******************************************************************************/
package org.jboss.unit;
+import java.io.Serializable;
+
/**
* The type of a failure.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public enum FailureType
+public enum FailureType implements Serializable
{
/**
* A failure that is not expected and produced an error.
Modified: modules/test/trunk/unit/src/main/java/org/jboss/unit/api/Assert.java
===================================================================
--- modules/test/trunk/unit/src/main/java/org/jboss/unit/api/Assert.java 2007-11-19
11:23:25 UTC (rev 9023)
+++ modules/test/trunk/unit/src/main/java/org/jboss/unit/api/Assert.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -335,6 +335,96 @@
}
}
+ /** @see #assertEquals(int[],int[]) */
+ public static void assertEquals(int[] expected, int[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(int[], int[]). */
+ public static void assertEquals(String message, int[] expected, int[] actual)
+ {
+ if (!Arrays.equals(expected, actual))
+ {
+ fail(format(message, expected, expected));
+ }
+ }
+
+ /** @see #assertEquals(float[],float[]) */
+ public static void assertEquals(float[] expected, float[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(float[], float[]). */
+ public static void assertEquals(String message, float[] expected, float[] actual)
+ {
+ if (!Arrays.equals(expected, actual))
+ {
+ fail(format(message, expected, expected));
+ }
+ }
+
+ /** @see #assertEquals(short[],short[]) */
+ public static void assertEquals(short[] expected, short[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(short[], short[]). */
+ public static void assertEquals(String message, short[] expected, short[] actual)
+ {
+ if (!Arrays.equals(expected, actual))
+ {
+ fail(format(message, expected, expected));
+ }
+ }
+
+ /** @see #assertEquals(long[],long[]) */
+ public static void assertEquals(long[] expected, long[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(long[], long[]). */
+ public static void assertEquals(String message, long[] expected, long[] actual)
+ {
+ if (!Arrays.equals(expected, actual))
+ {
+ fail(format(message, expected, expected));
+ }
+ }
+
+ /** @see #assertEquals(double[],double[]) */
+ public static void assertEquals(double[] expected, double[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(double[], double[]). */
+ public static void assertEquals(String message, double[] expected, double[] actual)
+ {
+ if (!Arrays.equals(expected, actual))
+ {
+ fail(format(message, expected, expected));
+ }
+ }
+
+ /** @see #assertEquals(boolean[],boolean[]) */
+ public static void assertEquals(boolean[] expected, boolean[] actual)
+ {
+ assertEquals(null, expected, actual);
+ }
+
+ /** Test equality as defined by java.util.Array#equals(boolean[], boolean[]). */
+ public static void assertEquals(String message, boolean[] expected, boolean[] actual)
+ {
+ if (!Arrays.equals(expected, actual))
+ {
+ fail(format(message, expected, expected));
+ }
+ }
+
private static String format(String message, Object expected, Object actual)
{
String formatted = "";
Modified:
modules/test/trunk/unit/src/main/java/org/jboss/unit/runner/model/pojo/POJOTestSuiteDef.java
===================================================================
---
modules/test/trunk/unit/src/main/java/org/jboss/unit/runner/model/pojo/POJOTestSuiteDef.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/main/java/org/jboss/unit/runner/model/pojo/POJOTestSuiteDef.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -50,7 +50,7 @@
testClasses.add(testDef);
}
- public Collection<TestClassDef> getTestClasses()
+ public List<TestClassDef> getTestClasses()
{
return testClasses;
}
Modified: modules/test/trunk/unit/src/test/java/org/jboss/test/unit/AllTests.java
===================================================================
--- modules/test/trunk/unit/src/test/java/org/jboss/test/unit/AllTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++ modules/test/trunk/unit/src/test/java/org/jboss/test/unit/AllTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -34,37 +34,13 @@
public void testAll() throws Exception
{
- SampleTests.test1();
+// SampleTests.test1();
//SampleTests.test2();
}
public static void main(String[] args) throws Exception
{
-// AssertTests.main(args);
-// TestIdTests.main(args);
-//
-// //
-// AbstractPOJOTests.main(args);
-// JUnitPOJOTests.main(args);
-// CompositeTestRunnerTests.main(args);
-// TestDriverRunnerTests.main(args);
-// GenericTestRunnerTests.main(args);
-// POJOTestRunnerTests.main(args);
-//
-// //
-// TestRunnerLifeCycleFilterTests.main(args);
-// TestRunnerEventBroadcasterSupportTests.main(args);
-// ModelTests.main(args);
-// ParametrizationTests.main(args);
-//
-// //
-// InfoTests.main(args);
-
//
- AllTests allTests = new AllTests();
- allTests.testAll();
-
- //
// JUnitReporterTests.main(args);
}
}
Modified: modules/test/trunk/unit/src/test/java/org/jboss/test/unit/TestIdTests.java
===================================================================
--- modules/test/trunk/unit/src/test/java/org/jboss/test/unit/TestIdTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++ modules/test/trunk/unit/src/test/java/org/jboss/test/unit/TestIdTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -39,25 +39,8 @@
public class TestIdTests extends TestCase
{
- public void testAll() throws Exception
+ public static void testGetNameThrowsIAE()
{
- testEquals();
- testCtor();
- testCtorThrowsIAE();
- testRange();
- testRangeThrowsIAE();
- testGetNameThrowsIAE();
- }
-
-
- public static void main(String[] args) throws Exception
- {
- TestIdTests tests = new TestIdTests();
- tests.testAll();
- }
-
- private static void testGetNameThrowsIAE()
- {
try
{
new TestId().getName(-1);
@@ -84,7 +67,7 @@
}
}
- private static void testRangeThrowsIAE()
+ public static void testRangeThrowsIAE()
{
try
{
@@ -120,7 +103,7 @@
}
}
- private static void testRange()
+ public static void testRange()
{
assertValue(new TestId().range(0));
assertValue(new TestId("abc").range(1));
@@ -130,7 +113,7 @@
assertValue(new TestId("abc", "def", "ghi").range(2),
"ghi");
}
- private static void testEquals()
+ public static void testEquals()
{
assertEquals(new TestId(), new TestId());
assertNotEquals(new TestId(), new TestId("abc"));
@@ -143,7 +126,7 @@
assertEquals(new TestId("abc", "def"), new
TestId("abc", "def"));
}
- private static void testCtor()
+ public static void testCtor()
{
assertValue(new TestId());
assertValue(new TestId("abc"), "abc");
@@ -153,7 +136,7 @@
assertValue(new TestId(list("abc", "def")), "abc",
"def");
}
- private static void testCtorThrowsIAE()
+ public static void testCtorThrowsIAE()
{
try
{
@@ -205,7 +188,7 @@
}
}
- private static void assertValue(TestId id, String... names)
+ public static void assertValue(TestId id, String... names)
{
assertEquals(names.length, id.getLength());
for (int i = 0;i < id.getLength();i++)
@@ -218,7 +201,10 @@
{
tmp.add(i.next());
}
- assertEquals(names, tmp.toArray(new String[tmp.size()]));
-
+ assertEquals(names.length, tmp.size());
+ for (int i = 0;i < names.length;i++)
+ {
+ assertEquals(names[i], tmp.get(i));
+ }
}
}
Modified: modules/test/trunk/unit/src/test/java/org/jboss/test/unit/api/AssertTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/api/AssertTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/api/AssertTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,13 +22,14 @@
******************************************************************************/
package org.jboss.test.unit.api;
+import junit.framework.TestCase;
import org.jboss.unit.api.Assert;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class AssertTests
+public class AssertTests extends TestCase
{
/** . */
@@ -37,20 +38,8 @@
/** . */
private final static Object o2 = new Object();
- public static void main(String[] args)
+ public static void testBoolean()
{
- testObjectEquals();
- testObjectNotEquals();
- testObjectSame();
- testObjectNotSame();
- testFail();
- testInstanceOf();
- testInteger();
- testBoolean();
- }
-
- private static void testBoolean()
- {
testAssertEquals(true, true);
testAssertEquals(true, new Boolean(true));
testAssertEquals(new Boolean(true), new Boolean(true));
@@ -65,7 +54,7 @@
testAssertNotEquals(null, new Boolean(true));
}
- private static void testInteger()
+ public static void testInteger()
{
testAssertEquals(1, 1);
testAssertEquals(1, new Integer(1));
@@ -81,7 +70,7 @@
testAssertNotEquals(null, new Integer(1));
}
- private static void testAssertEquals(Object left, Object right)
+ public static void testAssertEquals(Object left, Object right)
{
Assert.assertEquals(left, right);
try
@@ -94,7 +83,7 @@
}
}
- private static void testAssertNotEquals(Object left, Object right)
+ public static void testAssertNotEquals(Object left, Object right)
{
Assert.assertNotEquals(left, right);
try
@@ -107,7 +96,7 @@
}
}
- private static void testInstanceOf()
+ public static void testInstanceOf()
{
try
{
@@ -194,23 +183,23 @@
}
}
- private static class A
+ public static class A
{
}
- private static interface B
+ public static interface B
{
}
- private static interface C extends B
+ public static interface C extends B
{
}
- private static class D extends A implements C
+ public static class D extends A implements C
{
}
- private static void testObjectEquals()
+ public static void testObjectEquals()
{
try
{
@@ -241,7 +230,7 @@
Assert.assertEquals((Object)null, null);
}
- private static void testObjectNotEquals()
+ public static void testObjectNotEquals()
{
Assert.assertNotEquals(o1, null);
Assert.assertNotEquals(null, o1);
@@ -272,7 +261,7 @@
}
}
- private static void testObjectSame()
+ public static void testObjectSame()
{
try
{
@@ -310,7 +299,7 @@
Assert.assertSame(null, null);
}
- private static void testObjectNotSame()
+ public static void testObjectNotSame()
{
Assert.assertNotSame(o1, null);
Assert.assertNotSame(null, o1);
@@ -334,7 +323,7 @@
}
}
- private static void testFail()
+ public static void testFail()
{
try
{
@@ -387,4 +376,432 @@
}
}
}
+
+ public static void testObjectArray()
+ {
+ try
+ {
+ Assert.assertEquals(new String[0], new String[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new String[]{"a"}, new String[]{"a"});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new String[]{"a","b"}, new
String[]{"a","b"});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new Object[]{}, new Object[]{new Object()});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new Object[]{new Object()}, new Object[]{});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new Object[]{new Object()}, new Object[]{new Object()});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new Object[]{new Object()}, new Object[]{null});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new Object[]{null}, new Object[]{new Object()});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new Object[]{null}, new Object[]{null});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testIntArray()
+ {
+ try
+ {
+ Assert.assertEquals(new int[0], new int[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new int[]{0}, new int[]{0});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new int[]{0}, new int[]{1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new int[]{0}, new int[]{0,1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new int[]{0,1}, new int[]{0,1});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testByteArray()
+ {
+ try
+ {
+ Assert.assertEquals(new byte[0], new byte[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new byte[]{0}, new byte[]{0});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new byte[]{0}, new byte[]{1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new byte[]{0}, new byte[]{0,1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new byte[]{0,1}, new byte[]{0,1});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testShotArray()
+ {
+ try
+ {
+ Assert.assertEquals(new short[0], new short[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new short[]{0}, new short[]{0});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new short[]{0}, new short[]{1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new short[]{0}, new short[]{0,1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new short[]{0,1}, new short[]{0,1});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testLongArray()
+ {
+ try
+ {
+ Assert.assertEquals(new long[0], new long[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new long[]{0}, new long[]{0});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new long[]{0}, new long[]{1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new long[]{0}, new long[]{0,1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new long[]{0,1}, new long[]{0,1});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testFloatArray()
+ {
+ try
+ {
+ Assert.assertEquals(new float[0], new float[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new float[]{0}, new float[]{0});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new float[]{0}, new float[]{1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new float[]{0}, new float[]{0,1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new float[]{0,1}, new float[]{0,1});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testDoubleArray()
+ {
+ try
+ {
+ Assert.assertEquals(new double[0], new double[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new double[]{0}, new double[]{0});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new double[]{0}, new double[]{1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new double[]{0}, new double[]{0,1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new double[]{0,1}, new double[]{0,1});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testCharArray()
+ {
+ try
+ {
+ Assert.assertEquals(new char[0], new char[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new char[]{0}, new char[]{0});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new char[]{0}, new char[]{1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new char[]{0}, new char[]{0,1});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new char[]{0,1}, new char[]{0,1});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void testBooleanArray()
+ {
+ try
+ {
+ Assert.assertEquals(new boolean[0], new boolean[0]);
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new boolean[]{false}, new boolean[]{false});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ try
+ {
+ Assert.assertEquals(new boolean[]{false}, new boolean[]{true});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new boolean[]{false}, new boolean[]{false,true});
+ throw new RuntimeException();
+ }
+ catch (AssertionError e)
+ {
+ }
+ try
+ {
+ Assert.assertEquals(new boolean[]{false,true}, new boolean[]{false,true});
+ }
+ catch (AssertionError e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
}
Modified: modules/test/trunk/unit/src/test/java/org/jboss/test/unit/info/InfoTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/info/InfoTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/info/InfoTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,38 +22,31 @@
******************************************************************************/
package org.jboss.test.unit.info;
-import org.jboss.unit.info.impl.SimpleParameterInfo;
-import org.jboss.unit.info.impl.SimpleTestCaseInfo;
-import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
+import junit.framework.TestCase;
+import static org.jboss.unit.api.Assert.assertInstanceOf;
import org.jboss.unit.info.ParameterInfo;
import org.jboss.unit.info.TestCaseInfo;
import org.jboss.unit.info.TestSuiteInfo;
+import org.jboss.unit.info.impl.SimpleParameterInfo;
+import org.jboss.unit.info.impl.SimpleTestCaseInfo;
+import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
+import static org.jboss.unit.util.CollectionTools.list;
+import static org.jboss.unit.util.CollectionTools.set;
-import static org.jboss.unit.api.Assert.*;
-import static org.jboss.unit.util.CollectionTools.*;
-
-import java.util.List;
import java.util.Collections;
-import java.util.Map;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class InfoTests
+public class InfoTests extends TestCase
{
- public static void main(String[] args)
+ public static void testSuiteParameterInfo()
{
- testParameterInfo();
- testTestCaseInfo();
- testSuiteInfo();
- testSuiteParameterInfo();
- }
-
- private static void testSuiteParameterInfo()
- {
SimpleTestSuiteInfo testSuite = new
SimpleTestSuiteInfo("my_test_suite");
//
@@ -84,7 +77,7 @@
assertEquals(set(), testSuite.getParameters().keySet());
}
- private static void testParameterInfo()
+ public static void testParameterInfo()
{
try
{
@@ -140,7 +133,7 @@
assertEquals(list("v1", "v2"), copy.getDefaultValues());
}
- private static void testTestCaseInfo()
+ public static void testTestCaseInfo()
{
try
{
@@ -217,7 +210,7 @@
// Test cloning
}
- private static void testSuiteInfo()
+ public static void testSuiteInfo()
{
try
{
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/AbstractPOJOTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/AbstractPOJOTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/AbstractPOJOTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,85 +22,83 @@
******************************************************************************/
package org.jboss.test.unit.pojo;
+import junit.framework.TestCase;
import org.jboss.unit.api.Assert;
+import static org.jboss.unit.util.CollectionTools.set;
-import static org.jboss.unit.util.CollectionTools.*;
-import static org.jboss.unit.api.Assert.*;
-
-import java.util.Map;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public abstract class AbstractPOJOTests
+public abstract class AbstractPOJOTests extends TestCase
{
- public static void main(String[] args)
- {
- new TestDriverPOJOTests().test();
- new TestHandlerSupportPOJOTests().test();
- }
+// public static void main(String[] args)
+// {
+// new TestDriverPOJOTests().test();
+// new TestHandlerSupportPOJOTests().test();
+// }
+// public void test()
+// {
+// testAbstractClassWithoutAnnotations();
+// testClassWithoutAnnotations();
+// testAbstractClassAnnotatedWithTest();
+// testClassAnnotatedWithTest();
+// testClassAnnotatedWithTag();
+//
+// //
+// testMethodAnnotatedWithTest();
+// testTestMethodHavingArgumentsAnnotatedWithParameter();
+// testTestMethodAnnotatedWithConflictingAnnotations();
+// testMethodAnnotatedWithParameter();
+// testMethodAnnotatedWithCreate();
+// testMethodAnnotatedWithTag();
+//
+// //
+// testMethodAndMethodArgumentAnnotatedWithParameter();
+//
+// //
+// testClassWithoutDefaultConstructor();
+// testClassWithFailingConstructor();
+//
+// //
+// testLifeCycleSequence();
+// }
- public void test()
+ public void testClassAnnotatedWithTag()
{
- testAbstractClassWithoutAnnotations();
- testClassWithoutAnnotations();
- testAbstractClassAnnotatedWithTest();
- testClassAnnotatedWithTest();
- testClassAnnotatedWithTag();
-
- //
- testMethodAnnotatedWithTest();
- testTestMethodHavingArgumentsAnnotatedWithParameter();
- testTestMethodAnnotatedWithConflictingAnnotations();
- testMethodAnnotatedWithParameter();
- testMethodAnnotatedWithCreate();
- testMethodAnnotatedWithTag();
-
- //
- testMethodAndMethodArgumentAnnotatedWithParameter();
-
- //
- testClassWithoutDefaultConstructor();
- testClassWithFailingConstructor();
-
- //
- testLifeCycleSequence();
- }
-
- private void testClassAnnotatedWithTag()
- {
testClassAnnotatedWithTag(ClassAnnotatedWithTag1.class,
set("annotation_foo"));
testClassAnnotatedWithTag(ClassAnnotatedWithTag2.class,
set("annotation_foo", "annotation_bar"));
testClassAnnotatedWithTag(ClassAnnotatedWithTag3.class, new
HashSet<String>());
}
- private void testClassAnnotatedWithTag(Class clazz, Set<String> keywords)
+ public void testClassAnnotatedWithTag(Class clazz, Set<String> keywords)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
Assert.assertEquals(keywords, driver.getKeywords());
}
- private void testMethodAnnotatedWithTag()
+ public void testMethodAnnotatedWithTag()
{
testMethodAnnotatedWithTag(MethodAnnotatedWithTag1.class, "testFoo",
set("annotation_foo"));
testMethodAnnotatedWithTag(MethodAnnotatedWithTag2.class, "testFoo",
set("annotation_foo", "annotation_bar"));
testMethodAnnotatedWithTag(MethodAnnotatedWithTag3.class, "testFoo", new
HashSet<String>());
}
- private void testMethodAnnotatedWithTag(Class clazz, String testName,
Set<String> keywords)
+ public void testMethodAnnotatedWithTag(Class clazz, String testName, Set<String>
keywords)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
Assert.assertEquals(keywords, driver.getTestCaseKeywords(testName));
}
- private void testLifeCycleSequence()
+ public void testLifeCycleSequence()
{
testLifeCycleSequence(LifeCycleSequence01.class,
AbstractPOJOTest.InvokeResult.ERROR, null, false);
testLifeCycleSequence(LifeCycleSequence02.class,
AbstractPOJOTest.InvokeResult.FAILURE, null, false);
@@ -115,7 +113,7 @@
testLifeCycleSequence(LifeCycleSequence11.class,
AbstractPOJOTest.InvokeResult.PASS, "CSRD", true);
}
- private void testLifeCycleSequence(Class clazz, AbstractPOJOTest.InvokeResult result,
String expected, boolean invoked)
+ public void testLifeCycleSequence(Class clazz, AbstractPOJOTest.InvokeResult result,
String expected, boolean invoked)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
@@ -126,7 +124,7 @@
Assert.assertEquals(expected, POJOAssert.buffer1);
}
- private void testMethodAnnotatedWithCreate()
+ public void testMethodAnnotatedWithCreate()
{
testMethodAnnotatedWithCreate(MethodAnnotatedWithCreate01.class);
testMethodAnnotatedWithCreate(MethodAnnotatedWithCreate02.class);
@@ -137,7 +135,7 @@
assertCannotBuildSuite(MethodAnnotatedWithCreate07.class);
}
- private void testMethodAnnotatedWithCreate(Class clazz)
+ public void testMethodAnnotatedWithCreate(Class clazz)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
@@ -145,7 +143,7 @@
invoke(driver, clazz, "testFoo", AbstractPOJOTest.InvokeResult.PASS,
true);
}
- private void testMethodAndMethodArgumentAnnotatedWithParameter()
+ public void testMethodAndMethodArgumentAnnotatedWithParameter()
{
AbstractPOJOTest driver1 =
assertCanBuildSuite(MethodAndMethodArgumentAnnotatedWithParameter1.class);
invoke(driver1, MethodAndMethodArgumentAnnotatedWithParameter1.class,
"testFoo", AbstractPOJOTest.InvokeResult.PASS, true);
@@ -156,7 +154,7 @@
assertTrue(driver2.getParameterNames().containsAll(driver2.getTestCaseParameterNames("testFoo")));
}
- private void testClassWithFailingConstructor()
+ public void testClassWithFailingConstructor()
{
testClassWithFailingConstructor(ClassWithFailingConstructor1.class,
AbstractPOJOTest.InvokeResult.ERROR, false);
testClassWithFailingConstructor(ClassWithFailingConstructor2.class,
AbstractPOJOTest.InvokeResult.ERROR, false);
@@ -164,7 +162,7 @@
testClassWithFailingConstructor(ClassWithFailingConstructor4.class,
AbstractPOJOTest.InvokeResult.FAILURE, false);
}
- private void testClassWithFailingConstructor(Class clazz,
AbstractPOJOTest.InvokeResult result, boolean invoked)
+ public void testClassWithFailingConstructor(Class clazz, AbstractPOJOTest.InvokeResult
result, boolean invoked)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
@@ -172,7 +170,7 @@
invoke(driver, clazz, "testFoo", result, invoked);
}
- private void testClassWithoutDefaultConstructor()
+ public void testClassWithoutDefaultConstructor()
{
assertCannotBuildSuite(ClassWithoutDefaultConstructor1.class);
assertCannotBuildSuite(ClassWithoutDefaultConstructor2.class);
@@ -180,7 +178,7 @@
assertCannotBuildSuite(ClassWithoutDefaultConstructor4.class);
}
- private void testMethodAnnotatedWithParameter()
+ public void testMethodAnnotatedWithParameter()
{
testMethodAnnotatedWithParameter(MethodAnnotatedWithParameter01.class, false,
AbstractPOJOTest.InvokeResult.PASS, true, "foo");
testMethodAnnotatedWithParameter(MethodAnnotatedWithParameter02.class, false,
AbstractPOJOTest.InvokeResult.PASS, true, "bar");
@@ -194,7 +192,7 @@
testMethodAnnotatedWithParameter(MethodAnnotatedWithParameter13.class, true,
AbstractPOJOTest.InvokeResult.FAILURE, false, "foo");
}
- private void testMethodAnnotatedWithParameter(Class clazz, boolean invoke,
AbstractPOJOTest.InvokeResult result, boolean invoked, String... expectedParameterNames)
+ public void testMethodAnnotatedWithParameter(Class clazz, boolean invoke,
AbstractPOJOTest.InvokeResult result, boolean invoked, String... expectedParameterNames)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
@@ -214,7 +212,7 @@
}
}
- private void testTestMethodAnnotatedWithConflictingAnnotations()
+ public void testTestMethodAnnotatedWithConflictingAnnotations()
{
assertCannotBuildSuite(TestMethodAnnotatedWithConflictingAnnotations1.class);
assertCannotBuildSuite(TestMethodAnnotatedWithConflictingAnnotations2.class);
@@ -222,7 +220,7 @@
assertCannotBuildSuite(TestMethodAnnotatedWithConflictingAnnotations4.class);
}
- private void testTestMethodHavingArgumentsAnnotatedWithParameter(Class clazz,
String... expectedParameterNames)
+ public void testTestMethodHavingArgumentsAnnotatedWithParameter(Class clazz, String...
expectedParameterNames)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
@@ -236,7 +234,7 @@
invoke(driver, clazz, "testFoo", AbstractPOJOTest.InvokeResult.PASS,
true);
}
- private void testTestMethodHavingArgumentsAnnotatedWithParameter()
+ public void testTestMethodHavingArgumentsAnnotatedWithParameter()
{
testTestMethodHavingArgumentsAnnotatedWithParameter(TestMethodHavingArgumentsAnnotatedWithParameter1.class,
"paramFoo");
testTestMethodHavingArgumentsAnnotatedWithParameter(TestMethodHavingArgumentsAnnotatedWithParameter2.class,
"paramFoo", "paramBar");
@@ -248,7 +246,7 @@
assertCannotBuildSuite(TestMethodHavingArgumentsAnnotatedWithParameter8.class);
}
- private void testMethodAnnotatedWithTest()
+ public void testMethodAnnotatedWithTest()
{
testMethodAnnotatedWithTest(MethodAnnotatedWithTest1.class, "testFoo");
testMethodAnnotatedWithTest(MethodAnnotatedWithTest2.class, "testBar");
@@ -259,7 +257,7 @@
assertCannotBuildSuite(MethodAnnotatedWithTest9.class);
}
- private void testMethodAnnotatedWithTest(Class clazz, String testName)
+ public void testMethodAnnotatedWithTest(Class clazz, String testName)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
@@ -271,38 +269,38 @@
invoke(driver, clazz, testName, AbstractPOJOTest.InvokeResult.PASS, true);
}
- private void testAbstractClassWithoutAnnotations()
+ public void testAbstractClassWithoutAnnotations()
{
assertCannotBuildSuite(AbstractClassWithoutAnnotations.class);
}
- private void testClassWithoutAnnotations()
+ public void testClassWithoutAnnotations()
{
AbstractPOJOTest driver = assertCanBuildSuite(ClassWithoutAnnotations.class);
Assert.assertEquals(new HashSet(), driver.getParameterNames());
Assert.assertEquals(new HashSet(), driver.getTestCaseNames());
}
- private void testAbstractClassAnnotatedWithTest()
+ public void testAbstractClassAnnotatedWithTest()
{
assertCannotBuildSuite(AbstractClassAnnotatedWithTest1.class);
assertCannotBuildSuite(AbstractClassAnnotatedWithTest2.class);
}
- private void testClassAnnotatedWithTest()
+ public void testClassAnnotatedWithTest()
{
testClassAnnotatedPOJO(ClassAnnotatedWithTest1.class,
ClassAnnotatedWithTest1.class.getName(), null);
testClassAnnotatedPOJO(ClassAnnotatedWithTest2.class, "foo", null);
}
- private void testClassAnnotatedPOJO(Class clazz, String name, String description)
+ public void testClassAnnotatedPOJO(Class clazz, String name, String description)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
Assert.assertEquals(new HashSet(), driver.getParameterNames());
Assert.assertEquals(new HashSet(), driver.getTestCaseNames());
}
- private void assertParametersEquals(Set<String> parametersInfo, String...
expectedParameterNames)
+ public void assertParametersEquals(Set<String> parametersInfo, String...
expectedParameterNames)
{
Assert.assertEquals(expectedParameterNames.length, parametersInfo.size());
for (String expectedParameterName : expectedParameterNames)
@@ -313,7 +311,7 @@
// *************************
- private void invoke(AbstractPOJOTest driver, Class clazz, String testName,
AbstractPOJOTest.InvokeResult expectedResult, boolean invoked)
+ public void invoke(AbstractPOJOTest driver, Class clazz, String testName,
AbstractPOJOTest.InvokeResult expectedResult, boolean invoked)
{
Map<String, String> parametrization = new HashMap<String, String>();
Map<String,Object> expectedParameterValues = new HashMap<String,
Object>();
@@ -338,7 +336,7 @@
}
}
- private void assertClassHasNoTests(Class clazz)
+ public void assertClassHasNoTests(Class clazz)
{
AbstractPOJOTest driver = assertCanBuildSuite(clazz);
Assert.assertEquals(Collections.EMPTY_SET, driver.getTestCaseNames());
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/TestDriverPOJOTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/TestDriverPOJOTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/TestDriverPOJOTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -42,11 +42,11 @@
}
catch (InstantiationException e)
{
- fail(e);
+ fail();
}
catch (IllegalAccessException e)
{
- fail(e);
+ fail();
}
catch (IllegalArgumentException expected)
{
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/pojo/junit/JUnitPOJOTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,19 +22,20 @@
******************************************************************************/
package org.jboss.test.unit.pojo.junit;
-import org.jboss.unit.driver.impl.pojo.POJOTestSuiteDriver;
-
-import static org.jboss.unit.util.CollectionTools.*;
-import static org.jboss.unit.api.Assert.*;
-import org.jboss.unit.TestId;
+import junit.framework.TestCase;
import org.jboss.unit.Failure;
import org.jboss.unit.FailureType;
+import org.jboss.unit.TestId;
+import static org.jboss.unit.api.Assert.assertInstanceOf;
+import static org.jboss.unit.api.Assert.createFailure;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.command.StartTestCommand;
+import org.jboss.unit.driver.impl.pojo.POJOTestSuiteDriver;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.driver.response.FailureResponse;
import org.jboss.unit.info.TestInfo;
import org.jboss.unit.info.TestSuiteInfo;
-import org.jboss.unit.driver.command.StartTestCommand;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.FailureResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.util.CollectionTools.set;
import java.util.HashMap;
import java.util.HashSet;
@@ -43,18 +44,18 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class JUnitPOJOTests
+public class JUnitPOJOTests extends TestCase
{
- public static void main(String[] args)
- {
- test1();
- test2();
- test3();
- test4();
- }
+// public static void main(String[] args)
+// {
+// test1();
+// test2();
+// test3();
+// test4();
+// }
- private static void test1()
+ public static void test1()
{
POJOTestSuiteDriver driver = createDriver(JUnitTest1.class);
TestInfo driverInfo = driver.getInfo();
@@ -70,7 +71,7 @@
assertEquals(FailureType.ERROR, failure.getType());
}
- private static void test2()
+ public static void test2()
{
POJOTestSuiteDriver driver = createDriver(JUnitTest2.class);
TestInfo driverInfo = driver.getInfo();
@@ -84,7 +85,7 @@
assertInstanceOf(response, EndTestResponse.class);
}
- private static void test3()
+ public static void test3()
{
POJOTestSuiteDriver driver = createDriver(JUnitTest3.class);
TestInfo driverInfo = driver.getInfo();
@@ -100,7 +101,7 @@
assertEquals(FailureType.ERROR, failure.getType());
}
- private static void test4()
+ public static void test4()
{
POJOTestSuiteDriver driver = createDriver(JUnitTest4.class);
TestInfo driverInfo = driver.getInfo();
@@ -116,7 +117,7 @@
assertEquals(FailureType.ERROR, failure.getType());
}
- private static void test5()
+ public static void test5()
{
POJOTestSuiteDriver driver = createDriver(JUnitTest5.class);
TestInfo driverInfo = driver.getInfo();
@@ -132,7 +133,7 @@
assertEquals(FailureType.ERROR, failure.getType());
}
- private static POJOTestSuiteDriver createDriver(Class clazz)
+ public static POJOTestSuiteDriver createDriver(Class clazz)
{
try
{
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/report/junit/JUnitReporterTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/report/junit/JUnitReporterTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/report/junit/JUnitReporterTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,10 +22,12 @@
******************************************************************************/
package org.jboss.test.unit.report.junit;
+import junit.framework.TestCase;
import org.jboss.unit.Failure;
import org.jboss.unit.FailureType;
import org.jboss.unit.TestId;
import org.jboss.unit.api.Assert;
+import static org.jboss.unit.report.impl.junit.XMLConstants.*;
import org.jboss.unit.runner.TestResult;
import org.jboss.unit.runner.event.EndRunnerEvent;
import org.jboss.unit.runner.event.EndTestCaseEvent;
@@ -34,30 +36,20 @@
import org.jboss.unit.runner.event.StartTestCaseEvent;
import org.jboss.unit.runner.results.TestFailure;
import org.jboss.unit.runner.results.TestSuccess;
+import static org.jboss.unit.util.XMLTools.child;
import org.w3c.dom.Element;
-import static org.jboss.unit.util.XMLTools.*;
-import static org.jboss.unit.report.impl.junit.XMLConstants.*;
-
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel
Muckenhuber</a>
* @version $Revision$
*/
-public class JUnitReporterTests
+public class JUnitReporterTests extends TestCase
{
/** The testSuiteName */
private final static String testSuiteName = JUnitReporterTests.class.getName();
- public static void main(String[] args) throws Exception
+ public static void testTestSuite()
{
- testTestSuite();
- testTestCase();
- testTestCaseFailure();
- testTestCaseClass();
- }
-
- private static void testTestSuite()
- {
MyTestReport report = new MyTestReport(testSuiteName);
// add StartRunnerEvent
report.startJUnitTestSuite(new StartRunnerEvent());
@@ -94,7 +86,7 @@
* Successful testCase
*
*/
- private static void testTestCase()
+ public static void testTestCase()
{
MyTestReport report = new MyTestReport(testSuiteName);
report.startJUnitTestSuite(new StartRunnerEvent());
@@ -127,7 +119,7 @@
* Successful testCase with class info
*
*/
- private static void testTestCaseClass()
+ public static void testTestCaseClass()
{
MyTestReport report = new MyTestReport(testSuiteName);
report.startJUnitTestSuite(new StartRunnerEvent());
@@ -161,7 +153,7 @@
}
- private static void testTestCaseFailure()
+ public static void testTestCaseFailure()
{
MyTestReport report = new MyTestReport(testSuiteName);
report.startJUnitTestSuite(new StartRunnerEvent());
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/AbstractTestRunnerTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/AbstractTestRunnerTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/AbstractTestRunnerTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,23 +22,23 @@
******************************************************************************/
package org.jboss.test.unit.runner;
+import junit.framework.TestCase;
+import org.jboss.unit.TestId;
import org.jboss.unit.driver.AbstractTestDriver;
+import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.command.StartTestCommand;
-import org.jboss.unit.TestId;
-import static org.jboss.unit.api.Assert.assertEquals;
+import org.jboss.unit.info.TestInfo;
import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
-import org.jboss.unit.info.TestInfo;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class AbstractTestRunnerTests
+public class AbstractTestRunnerTests extends TestCase
{
protected static class TestDriverImpl extends AbstractTestDriver
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/CompositeTestRunnerTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/CompositeTestRunnerTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/CompositeTestRunnerTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -30,18 +30,19 @@
import org.jboss.unit.runner.impl.composite.CompositeTestRunner;
import org.jboss.unit.runner.impl.TestRunnerContextSupport;
-import static org.jboss.unit.api.Assert.*;
import static org.jboss.unit.util.CollectionTools.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import junit.framework.TestCase;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class CompositeTestRunnerTests
+public class CompositeTestRunnerTests extends TestCase
{
private static List<TestRunnerEvent> events = new
ArrayList<TestRunnerEvent>();
@@ -54,16 +55,16 @@
}
};
- public static void main(String[] args)
- {
- testCompose();
- testComposeWithRuntimeException1();
- testComposeWithRuntimeException2();
- testComposeWithRuntimeError1();
- testComposeWithRuntimeError2();
- }
+// public static void main(String[] args)
+// {
+// testCompose();
+// testComposeWithRuntimeException1();
+// testComposeWithRuntimeException2();
+// testComposeWithRuntimeError1();
+// testComposeWithRuntimeError2();
+// }
- private static void testCompose()
+ public static void testCompose()
{
MyRunner1 runner1 = new MyRunner1();
MyRunner1 runner2 = new MyRunner1();
@@ -79,7 +80,7 @@
events.clear();
}
- private static void testComposeWithRuntimeException1()
+ public static void testComposeWithRuntimeException1()
{
MyRunner1 runner1 = new MyRunner1();
MyRunner2 runner2 = new MyRunner2();
@@ -102,7 +103,7 @@
events.clear();
}
- private static void testComposeWithRuntimeException2()
+ public static void testComposeWithRuntimeException2()
{
MyRunner2 runner1 = new MyRunner2();
MyRunner1 runner2 = new MyRunner1();
@@ -124,7 +125,7 @@
events.clear();
}
- private static void testComposeWithRuntimeError1()
+ public static void testComposeWithRuntimeError1()
{
MyRunner1 runner1 = new MyRunner1();
MyRunner3 runner2 = new MyRunner3();
@@ -147,7 +148,7 @@
events.clear();
}
- private static void testComposeWithRuntimeError2()
+ public static void testComposeWithRuntimeError2()
{
MyRunner3 runner1 = new MyRunner3();
MyRunner1 runner2 = new MyRunner1();
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/GenericTestRunnerTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/GenericTestRunnerTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/GenericTestRunnerTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,55 +22,54 @@
******************************************************************************/
package org.jboss.test.unit.runner;
-import org.jboss.unit.runner.impl.generic.GenericTestRunner;
-import org.jboss.unit.runner.impl.TestRunnerContextSupport;
-import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
-import org.jboss.unit.runner.model.generic.TestDef;
-import org.jboss.unit.runner.model.ParametersDef;
-import org.jboss.unit.runner.model.ParameterValueDef;
-import org.jboss.unit.runner.ParametrizationSet;
-import org.jboss.unit.runner.results.TestSuccess;
-import org.jboss.unit.driver.DriverResponse;
+import junit.framework.TestCase;
+import org.jboss.unit.TestId;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.DriverContext;
+import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.TestDriver;
import org.jboss.unit.driver.command.StartTestCommand;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.info.TestInfo;
-import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
-import org.jboss.unit.info.impl.SimpleTestCaseInfo;
import org.jboss.unit.info.impl.SimpleParameterInfo;
-import org.jboss.unit.TestId;
+import org.jboss.unit.info.impl.SimpleTestCaseInfo;
+import org.jboss.unit.info.impl.SimpleTestSuiteInfo;
+import org.jboss.unit.runner.ParametrizationSet;
+import org.jboss.unit.runner.impl.TestRunnerContextSupport;
+import org.jboss.unit.runner.impl.generic.GenericTestRunner;
+import org.jboss.unit.runner.model.ParameterValueDef;
+import org.jboss.unit.runner.model.ParametersDef;
+import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
+import org.jboss.unit.runner.model.generic.TestDef;
+import org.jboss.unit.runner.results.TestSuccess;
+import static org.jboss.unit.util.CollectionTools.list;
-import static org.jboss.unit.api.Assert.*;
-import static org.jboss.unit.util.CollectionTools.*;
-
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.ArrayList;
import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class GenericTestRunnerTests
+public class GenericTestRunnerTests extends TestCase
{
- public static void main(String[] args)
- {
- testNoTestCase();
- testOneTestCase();
- testTwoTestCases1();
- testTwoTestCases2();
- testParametrization();
- testParametrizationOverride();
- testProperties1();
- testProperties2();
- testProperties3();
- }
+// public static void main(String[] args)
+// {
+// testNoTestCase();
+// testOneTestCase();
+// testTwoTestCases1();
+// testTwoTestCases2();
+// testParametrization();
+// testParametrizationOverride();
+// testProperties1();
+// testProperties2();
+// testProperties3();
+// }
- private static void testProperties1()
+ public static void testProperties1()
{
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
@@ -84,7 +83,7 @@
assertEquals(expectedProperties, Driver1.properties);
}
- private static void testProperties2()
+ public static void testProperties2()
{
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
@@ -99,7 +98,7 @@
assertEquals(expectedProperties, Driver1.properties);
}
- private static void testProperties3()
+ public static void testProperties3()
{
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
@@ -119,7 +118,7 @@
assertEquals(expectedProperties, Driver1.properties);
}
- private static void testParametrization()
+ public static void testParametrization()
{
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
@@ -150,7 +149,7 @@
assertEquals(list(expectedParametrization1, expectedParametrization2),
Driver1.parametrizations);
}
- private static void testParametrizationOverride()
+ public static void testParametrizationOverride()
{
Driver1.init();
SimpleTestCaseInfo fooInfo = new SimpleTestCaseInfo("foo");
@@ -178,7 +177,7 @@
assertEquals(list(expectedParametrization1), Driver1.parametrizations);
}
- private static void testNoTestCase()
+ public static void testNoTestCase()
{
Driver1.init();
GenericTestSuiteDef suite = new GenericTestSuiteDef(Driver1.class.getName());
@@ -192,7 +191,7 @@
assertEquals(list(), Driver1.parametrizations);
}
- private static void testOneTestCase()
+ public static void testOneTestCase()
{
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
@@ -210,7 +209,7 @@
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
- private static void testTwoTestCases1()
+ public static void testTwoTestCases1()
{
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
@@ -229,7 +228,7 @@
assertEquals(list(new HashMap()), Driver1.parametrizations);
}
- private static void testTwoTestCases2()
+ public static void testTwoTestCases2()
{
Driver1.init();
Driver1.testSuiteInfo.addTest(new SimpleTestCaseInfo("foo"));
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/POJOTestRunnerTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/POJOTestRunnerTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/POJOTestRunnerTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -53,7 +53,7 @@
testPOJO1_2();
}
- private static void testPOJO1_1()
+ public static void testPOJO1_1()
{
POJO1.instances.clear();
@@ -71,7 +71,8 @@
//
assertEquals(1, POJO1.instances.size());
- POJO1 pojo1_1 = assertNotNull(POJO1.instances.get(0));
+ assertNotNull(POJO1.instances.get(0));
+ POJO1 pojo1_1 = POJO1.instances.get(0);
assertEquals("bar_def", pojo1_1.foo);
//
@@ -82,7 +83,7 @@
listener.assertEndRunnerEvent(5);
}
- private static void testPOJO1_2()
+ public static void testPOJO1_2()
{
POJO1.instances.clear();
@@ -104,9 +105,11 @@
//
assertEquals(2, POJO1.instances.size());
- POJO1 pojo1_1 = assertNotNull(POJO1.instances.get(0));
+ assertNotNull(POJO1.instances.get(0));
+ POJO1 pojo1_1 =POJO1.instances.get(0);
assertEquals("bar_runtime_1", pojo1_1.foo);
- POJO1 pojo1_2 = assertNotNull(POJO1.instances.get(1));
+ assertNotNull(POJO1.instances.get(1));
+ POJO1 pojo1_2 = POJO1.instances.get(1);
assertEquals("bar_runtime_2", pojo1_2.foo);
//
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/ParametrizationTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/ParametrizationTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/ParametrizationTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.runner;
-import static org.jboss.unit.api.Assert.assertEquals;
+import junit.framework.TestCase;
import org.jboss.unit.runner.ParametrizationSet;
import org.jboss.unit.util.CollectionTools;
@@ -35,20 +35,11 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ParametrizationTests
+public class ParametrizationTests extends TestCase
{
- public static void main(String[] args)
+ public static void test1()
{
- test1();
- test2();
- test3();
- test4();
- test5();
- }
-
- private static void test1()
- {
Map<String,String[]> map = new HashMap<String,String[]>();
ParametrizationSet def = new ParametrizationSet(map);
@@ -59,7 +50,7 @@
assertEquals(expectedResult, new HashSet<Map<String,
String>>(def.enumerate(contraints)));
}
- private static void test2()
+ public static void test2()
{
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b"});
@@ -86,7 +77,7 @@
assertEquals(expectedResult3, new HashSet<Map<String,
String>>(def.enumerate(contraints3)));
}
- private static void test3()
+ public static void test3()
{
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b","c"});
@@ -116,7 +107,7 @@
assertEquals(expectedResult3, new HashSet<Map<String,
String>>(def.enumerate(contraints3)));
}
- private static void test4()
+ public static void test4()
{
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b","c"});
@@ -162,7 +153,7 @@
assertEquals(expectedResult4, new HashSet<Map<String,
String>>(def.enumerate(contraints4)));
}
- private static void test5()
+ public static void test5()
{
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b","c"});
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/TestDriverRunnerTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/TestDriverRunnerTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -59,39 +59,39 @@
public class TestDriverRunnerTests extends AbstractTestRunnerTests
{
- public static void main(String[] args)
- {
- testEmptyDriver();
+// public static void main(String[] args)
+// {
+// testEmptyDriver();
+//
+// //
+// testTestDriverInvokeTestCaseReturnsNull();
+// testTestDriverInvokeTestCaseReturnsAnEndTestResponse();
+// testTestDriverInvokeTestCaseReturnsAFailureResponse();
+// testTestDriverInvokeTestCaseThrowsRuntimeException();
+// testTestDriverInvokeTestCaseThrowsError();
+//
+// //
+// testInvokeTestCaseWithParameters1();
+// testInvokeTestCaseWithParameters2();
+//
+// //
+// testInvokeTestSuite();
+//
+// //
+// testEvents1();
+//
+// //
+// testInit();
+// testInitThrowsDriverException();
+// testInitThrowsRuntimeException();
+// testInitThrowsError();
+//
+// //
+// testDestroyThrowsRuntimeException();
+// testDestroyThrowsError();
+// }
- //
- testTestDriverInvokeTestCaseReturnsNull();
- testTestDriverInvokeTestCaseReturnsAnEndTestResponse();
- testTestDriverInvokeTestCaseReturnsAFailureResponse();
- testTestDriverInvokeTestCaseThrowsRuntimeException();
- testTestDriverInvokeTestCaseThrowsError();
-
- //
- testInvokeTestCaseWithParameters1();
- testInvokeTestCaseWithParameters2();
-
- //
- testInvokeTestSuite();
-
- //
- testEvents1();
-
- //
- testInit();
- testInitThrowsDriverException();
- testInitThrowsRuntimeException();
- testInitThrowsError();
-
- //
- testDestroyThrowsRuntimeException();
- testDestroyThrowsError();
- }
-
- private static void testDestroyThrowsError()
+ public static void testDestroyThrowsError()
{
final Error error = new Error();
FailureTestDriver testDriver = new FailureTestDriver()
@@ -122,7 +122,7 @@
listener.assertEndTestEvent(2, new TestId(), new TestSuccess(0));
}
- private static void testDestroyThrowsRuntimeException()
+ public static void testDestroyThrowsRuntimeException()
{
FailureTestDriver testDriver = new FailureTestDriver()
{
@@ -145,7 +145,7 @@
listener.assertEndRunnerEvent(3);
}
- private static void testInit()
+ public static void testInit()
{
FailureTestDriver testDriver = new FailureTestDriver()
{
@@ -172,7 +172,7 @@
listener.assertEndRunnerEvent(3);
}
- private static void testInitThrowsDriverException()
+ public static void testInitThrowsDriverException()
{
FailureTestDriver testDriver = new FailureTestDriver()
{
@@ -199,7 +199,7 @@
listener.assertEndRunnerEvent(2);
}
- private static void testInitThrowsRuntimeException()
+ public static void testInitThrowsRuntimeException()
{
FailureTestDriver testDriver = new FailureTestDriver()
{
@@ -226,7 +226,7 @@
listener.assertEndRunnerEvent(2);
}
- private static void testInitThrowsError()
+ public static void testInitThrowsError()
{
final Error error = new Error();
FailureTestDriver testDriver = new FailureTestDriver()
@@ -261,7 +261,7 @@
listener.assertStartRunnerEvent(0);
}
- private static void testEvents1()
+ public static void testEvents1()
{
TestDriverImpl testDriver = new TestDriverImpl()
{
@@ -293,7 +293,7 @@
listener.assertEndRunnerEvent(7);
}
- private static void testInvokeTestSuite()
+ public static void testInvokeTestSuite()
{
TestDriverImpl testDriver = new TestDriverImpl()
{
@@ -327,7 +327,7 @@
listener.assertEndRunnerEvent(7);
}
- private static void testInvokeTestCaseWithParameters1()
+ public static void testInvokeTestCaseWithParameters1()
{
Map<String,String[]> tmp = new HashMap<String, String[]>();
tmp.put("foo", new String[]{"bar"});
@@ -370,7 +370,7 @@
assertEquals(s1, s2);
}
- private static void testInvokeTestCaseWithParameters2()
+ public static void testInvokeTestCaseWithParameters2()
{
Map<String,String[]> tmp = new HashMap<String, String[]>();
tmp.put("foo", new String[]{"bar1","bar2"});
@@ -425,7 +425,7 @@
assertEquals(s1, s2);
}
- private static void testEmptyDriver()
+ public static void testEmptyDriver()
{
TestDriverImpl testDriver = new TestDriverImpl();
TestDriverRunner runner = new TestDriverRunner(testDriver, new TestId());
@@ -445,7 +445,7 @@
listener.assertEndRunnerEvent(3);
}
- private static void testTestDriverInvokeTestCaseReturnsNull()
+ public static void testTestDriverInvokeTestCaseReturnsNull()
{
TestDriverImpl testDriver = new TestDriverImpl();
testDriver.info.addTest(new SimpleTestCaseInfo("Foo"));
@@ -468,7 +468,7 @@
listener.assertEndRunnerEvent(5);
}
- private static void testTestDriverInvokeTestCaseReturnsAnEndTestResponse()
+ public static void testTestDriverInvokeTestCaseReturnsAnEndTestResponse()
{
TestDriverImpl testDriver = new TestDriverImpl()
{
@@ -497,7 +497,7 @@
listener.assertEndRunnerEvent(5);
}
- private static void testTestDriverInvokeTestCaseReturnsAFailureResponse()
+ public static void testTestDriverInvokeTestCaseReturnsAFailureResponse()
{
TestDriverImpl testDriver = new TestDriverImpl()
{
@@ -526,7 +526,7 @@
listener.assertEndRunnerEvent(5);
}
- private static void testTestDriverInvokeTestCaseThrowsRuntimeException()
+ public static void testTestDriverInvokeTestCaseThrowsRuntimeException()
{
TestDriverImpl testDriver = new TestDriverImpl()
{
@@ -555,7 +555,7 @@
listener.assertEndRunnerEvent(5);
}
- private static void testTestDriverInvokeTestCaseThrowsError()
+ public static void testTestDriverInvokeTestCaseThrowsError()
{
final Error error = new Error();
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerEventBroadcasterSupportTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerEventBroadcasterSupportTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerEventBroadcasterSupportTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.runner.event;
-import static org.jboss.unit.api.Assert.*;
+import junit.framework.TestCase;
import org.jboss.unit.runner.TestRunnerEvent;
import org.jboss.unit.runner.TestRunnerEventListener;
import org.jboss.unit.runner.impl.TestRunnerEventBroadcaster;
@@ -35,7 +35,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class TestRunnerEventBroadcasterSupportTests
+public class TestRunnerEventBroadcasterSupportTests extends TestCase
{
/** . */
@@ -47,20 +47,8 @@
/** . */
private MyListener listener2 = new MyListener();
- public static void main(String[] args)
+ public void testAddNullListener()
{
- new TestRunnerEventBroadcasterSupportTests().testAddNullListener();
- new TestRunnerEventBroadcasterSupportTests().testRemoveNullListener();
- new TestRunnerEventBroadcasterSupportTests().testBroadcastNullEvent();
- new TestRunnerEventBroadcasterSupportTests().testDualRegistration();
- new TestRunnerEventBroadcasterSupportTests().testRegistration();
- new TestRunnerEventBroadcasterSupportTests().testUnregistration();
- new TestRunnerEventBroadcasterSupportTests().testBroadcast();
- new TestRunnerEventBroadcasterSupportTests().testFailure();
- }
-
- private void testAddNullListener()
- {
try
{
support.addListener(null);
@@ -71,7 +59,7 @@
}
}
- private void testRemoveNullListener()
+ public void testRemoveNullListener()
{
try
{
@@ -83,7 +71,7 @@
}
}
- private void testBroadcastNullEvent()
+ public void testBroadcastNullEvent()
{
try
{
@@ -95,7 +83,7 @@
}
}
- private void testDualRegistration()
+ public void testDualRegistration()
{
MyEvent event = new MyEvent();
support.addListener(listener1);
@@ -104,7 +92,7 @@
assertEquals(list(event), listener1.events);
}
- private void testRegistration()
+ public void testRegistration()
{
MyEvent event = new MyEvent();
support.addListener(listener1);
@@ -112,7 +100,7 @@
assertEquals(list(event), listener1.events);
}
- private void testUnregistration()
+ public void testUnregistration()
{
MyEvent event = new MyEvent();
support.addListener(listener1);
@@ -121,7 +109,7 @@
assertEquals(0, listener1.events.size());
}
- private void testBroadcast()
+ public void testBroadcast()
{
MyEvent event = new MyEvent();
support.addListener(listener1);
@@ -131,7 +119,7 @@
assertEquals(list(event), listener2.events);
}
- private void testFailure()
+ public void testFailure()
{
MyEvent event = new MyEvent();
support.addListener(listener1);
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerLifeCycleFilterTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerLifeCycleFilterTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/event/TestRunnerLifeCycleFilterTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -24,23 +24,24 @@
import static org.jboss.unit.api.Assert.assertNull;
import static org.jboss.unit.api.Assert.assertSame;
+import org.jboss.unit.api.pojo.junit.TestCase;
import org.jboss.unit.runner.TestRunnerEvent;
import org.jboss.unit.runner.TestRunnerEventListener;
-import org.jboss.unit.runner.impl.TestRunnerLifeCycleFilter;
import org.jboss.unit.runner.event.EndRunnerEvent;
import org.jboss.unit.runner.event.StartRunnerEvent;
+import org.jboss.unit.runner.impl.TestRunnerLifeCycleFilter;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class TestRunnerLifeCycleFilterTests
+public class TestRunnerLifeCycleFilterTests extends junit.framework.TestCase
{
/** . */
private static TestRunnerEvent event = null;
- public static void main(String[] args)
+ public static void testBasic()
{
TestRunnerEventListener broadcaster = new TestRunnerEventListener()
{
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/model/ModelTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/model/ModelTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/runner/model/ModelTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,20 +22,21 @@
******************************************************************************/
package org.jboss.test.unit.runner.model;
+import org.jboss.unit.TestId;
import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.api.pojo.junit.TestCase;
import org.jboss.unit.runner.model.ModelBuilder;
import org.jboss.unit.runner.model.ParameterValueDef;
import org.jboss.unit.runner.model.ParametersDef;
import org.jboss.unit.runner.model.TestSuiteDef;
+import org.jboss.unit.runner.model.composite.CompositeTestSuiteDef;
+import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
import org.jboss.unit.runner.model.generic.TestDef;
-import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
-import org.jboss.unit.runner.model.composite.CompositeTestSuiteDef;
import org.jboss.unit.runner.model.pojo.POJOTestSuiteDef;
+import org.jboss.unit.runner.model.pojo.TestCaseDef;
import org.jboss.unit.runner.model.pojo.TestClassDef;
-import org.jboss.unit.runner.model.pojo.TestCaseDef;
import static org.jboss.unit.util.CollectionTools.list;
import static org.jboss.unit.util.CollectionTools.set;
-import org.jboss.unit.TestId;
import org.xml.sax.InputSource;
import java.io.InputStream;
@@ -46,18 +47,9 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class ModelTests
+public class ModelTests extends junit.framework.TestCase
{
- public static void main(String[] args)
- {
- testParameterValueDef();
- buildFromXML1();
- buildFromXML2();
-
-
- }
-
private static TestSuiteDef buildTestSuite(String resourceId)
{
try
@@ -72,7 +64,7 @@
}
}
- private static void buildFromXML2()
+ public static void testBuildFromXML2()
{
TestSuiteDef suite = buildTestSuite("f2.xml");
@@ -83,19 +75,23 @@
assertEquals("foo_generic", generic.getClassName());
//
- ParametersDef parameters = assertNotNull(generic.getParameters());
+ assertNotNull(generic.getParameters());
+ ParametersDef parameters = generic.getParameters();
assertEquals(set("red"), parameters.getNames());
//
- List<TestDef> tests = assertNotNull(generic.getTests());
+ assertNotNull(generic.getTests());
+ List<TestDef> tests = generic.getTests();
assertEquals(2, tests.size());
- TestDef foo = assertNotNull(tests.get(0));
+ assertNotNull(tests.get(0));
+ TestDef foo = tests.get(0);
assertEquals(new TestId("foo"), foo.getRefId());
- TestDef fooBar = assertNotNull(tests.get(1));
+ assertNotNull(tests.get(1));
+ TestDef fooBar = tests.get(1);
assertEquals(new TestId("foo", "bar"), fooBar.getRefId());
}
- private static void buildFromXML1()
+ public static void testBuildFromXML1()
{
TestSuiteDef suite = buildTestSuite("f1.xml");
@@ -105,35 +101,41 @@
POJOTestSuiteDef pojoSuite =
assertInstanceOf(composite.getSuites().iterator().next(), POJOTestSuiteDef.class);
- Iterator<TestClassDef> testClasses = pojoSuite.getTestClasses().iterator();
+ List<TestClassDef> testClasses = pojoSuite.getTestClasses();
+ assertEquals(2, testClasses.size());
//
- assertTrue(testClasses.hasNext());
- TestClassDef otherTestClass = assertNotNull(testClasses.next());
+ TestClassDef otherTestClass = testClasses.get(0);
+ assertNotNull(otherTestClass);
assertEquals("org.foo.bar.OtherTest", otherTestClass.getName());
assertEquals(0, otherTestClass.getTestCases().size());
assertNotNull(otherTestClass.getParameters());
assertEquals(set("foo"), otherTestClass.getParameters().getNames());
- ParameterValueDef fooParam =
assertNotNull(otherTestClass.getParameters().getParameter("foo"));
+ assertNotNull(otherTestClass.getParameters().getParameter("foo"));
+ ParameterValueDef fooParam =
otherTestClass.getParameters().getParameter("foo");
assertEquals(list("bar"), fooParam.list());
//
- assertTrue(testClasses.hasNext());
- TestClassDef barClass = assertNotNull(testClasses.next());
+ TestClassDef barClass = testClasses.get(1);
+ assertNotNull(barClass);
assertEquals("org.Bar", barClass.getName());
assertEquals(2, barClass.getTestCases().size());
- TestCaseDef barFooCase = assertNotNull(barClass.getTestCase("foo"));
+ assertNotNull(barClass.getTestCase("foo"));
+ TestCaseDef barFooCase = barClass.getTestCase("foo");
assertEquals("foo", barFooCase.getName());
- TestCaseDef barBarCase = assertNotNull(barClass.getTestCase("bar"));
+ assertNotNull(barClass.getTestCase("bar"));
+ TestCaseDef barBarCase = barClass.getTestCase("bar");
assertEquals("bar", barBarCase.getName());
assertEquals(set("foo", "blah"),
barClass.getParameters().getNames());
- ParameterValueDef barClassFooParam =
assertNotNull(barClass.getParameters().getParameter("foo"));
+ assertNotNull(barClass.getParameters().getParameter("foo"));
+ ParameterValueDef barClassFooParam =
barClass.getParameters().getParameter("foo");
assertEquals(list("bar1", null), barClassFooParam.list());
- ParameterValueDef barClassBlahParam =
assertNotNull(barClass.getParameters().getParameter("blah"));
+ assertNotNull(barClass.getParameters().getParameter("blah"));
+ ParameterValueDef barClassBlahParam =
barClass.getParameters().getParameter("blah");
assertEquals(list("bluh"), barClassBlahParam.list());
}
- private static void testParameterValueDef()
+ public static void testParameterValueDef()
{
ParameterValueDef pvd1 = new ParameterValueDef();
assertEquals(list(), pvd1.list());
Modified:
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/sample/SampleTests.java
===================================================================
---
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/sample/SampleTests.java 2007-11-19
11:23:25 UTC (rev 9023)
+++
modules/test/trunk/unit/src/test/java/org/jboss/test/unit/sample/SampleTests.java 2007-11-19
15:20:59 UTC (rev 9024)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.test.unit.sample;
+import junit.framework.TestCase;
import org.jboss.unit.report.impl.junit.JUnitTestsuiteReport;
import org.jboss.unit.report.impl.writer.PrintListener;
import org.jboss.unit.runner.TestRunner;
@@ -44,17 +45,9 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class SampleTests
+public class SampleTests extends TestCase
{
- public static void main(String[] args) throws Exception
- {
-
-// test1();
- test2();
-
- }
-
public static void test1()
throws ParserConfigurationException, IOException, SAXException, BuilderException
{