Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects
In directory usw-pr-cvs1:/tmp/cvs-serv30920/src/core/test/mockobjects
Modified Files:
TestAssertMo.java
Log Message:
added assertFails() with tests
Index: TestAssertMo.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/TestAssertMo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestAssertMo.java 21 Oct 2002 22:52:38 -0000 1.1
+++ TestAssertMo.java 25 Oct 2002 22:06:07 -0000 1.2
@@ -153,4 +153,22 @@
anExpectedArray,
anActualArray);
}
+
+ public void testFailureCheckerWithFailure() {
+ AssertMo.assertFails("Test Description",
+ new Runnable() {
+ public void run() { fail("Should not be propagated"); }
+ });
+ }
+
+ public void testFailureCheckerWithoutFailure() {
+ final String TEST_MESSAGE = "Test Description";
+ try {
+ AssertMo.assertFails(TEST_MESSAGE, new Runnable() { public void run() {} });
+ } catch (AssertionFailedError expected) {
+ assertEquals(TEST_MESSAGE, expected.getMessage());
+ return;
+ }
+ fail("Should have thrown an exception");
+ }
}
|