01: package junit.tests.framework;
02:
03: import junit.framework.ComparisonFailure;
04: import junit.framework.TestCase;
05:
06: public class ComparisonFailureTest extends TestCase {
07:
08: // Most of the tests are in ComparisonCompactorTest
09: public void testConnection() {
10: ComparisonFailure failure = new ComparisonFailure("warning",
11: "Mary had a little lamb", "Mary had the little lamb");
12: assertEquals(
13: "warning expected:<Mary had [a] little lamb> but was:<Mary had [the] little lamb>",
14: failure.getMessage());
15: }
16:
17: // This is like an instanceof test.
18: public void testThrowing() {
19: try {
20: assertEquals("a", "b");
21: } catch (ComparisonFailure e) {
22: return;
23: }
24: fail();
25: }
26: }
|