01: package net.sf.mockcreator.expectable;
02:
03: import net.sf.mockcreator.TestCase;
04: import net.sf.mockcreator.expectable.ExpectRegexp;
05:
06: import net.sf.mockcreator.exceptions.MockException;
07:
08: public class ExpectRegexpTest extends TestCase {
09:
10: public ExpectRegexpTest(String name) {
11: super (name);
12: }
13:
14: public void testNull() {
15: try {
16: new ExpectRegexp(null);
17: fail();
18: } catch (IllegalArgumentException ex) {
19: // okay
20: }
21: }
22:
23: public void testRegexp() {
24: ExpectRegexp er = new ExpectRegexp("^Foo[0-9]+$");
25:
26: assertTrue(er.isExpected("Foo1"));
27: assertTrue(er.isExpected("Foo1234"));
28:
29: assertFalse(er.isExpected(" Foo1234"));
30: assertFalse(er.isExpected("Foo1234 "));
31: assertFalse(er.isExpected(""));
32: assertFalse(er.isExpected("Bar"));
33:
34: er.toString();
35: }
36: }
|