01: /*******************************************************************************
02: * Portions created by Sebastian Thomschke are copyright (c) 2005-2007 Sebastian
03: * Thomschke.
04: *
05: * All Rights Reserved. This program and the accompanying materials
06: * are made available under the terms of the Eclipse Public License v1.0
07: * which accompanies this distribution, and is available at
08: * http://www.eclipse.org/legal/epl-v10.html
09: *
10: * Contributors:
11: * Sebastian Thomschke - initial implementation.
12: *******************************************************************************/package net.sf.oval.test.constraints;
13:
14: import net.sf.oval.constraint.HasSubstringCheck;
15:
16: /**
17: * @author Sebastian Thomschke
18: */
19: public class HasSubStringTest extends AbstractContraintsTest {
20: public void testHasSubString() {
21: final HasSubstringCheck check = new HasSubstringCheck();
22: super .testCheck(check);
23: assertTrue(check.isSatisfied(null, null, null, null));
24:
25: check.setSubstring("TeSt");
26: assertEquals("TeSt", check.getSubstring());
27:
28: check.setIgnoreCase(false);
29: assertFalse(check.isIgnoreCase());
30:
31: assertFalse(check.isSatisfied(null, "bla", null, null));
32: assertFalse(check.isSatisfied(null, "test", null, null));
33: assertTrue(check.isSatisfied(null, "TeSt", null, null));
34: assertTrue(check.isSatisfied(null, "aaaTeStaaaa", null, null));
35: assertTrue(check.isSatisfied(null, "TeStaaaa", null, null));
36: assertTrue(check.isSatisfied(null, "aaaTeSt", null, null));
37:
38: check.setIgnoreCase(true);
39: assertTrue(check.isIgnoreCase());
40:
41: assertFalse(check.isSatisfied(null, "bla", null, null));
42: assertTrue(check.isSatisfied(null, "test", null, null));
43: assertTrue(check.isSatisfied(null, "TEst", null, null));
44: assertTrue(check.isSatisfied(null, "aaaTesTaaaa", null, null));
45: assertTrue(check.isSatisfied(null, "TEstaaaa", null, null));
46: assertTrue(check.isSatisfied(null, "aaatESt", null, null));
47: }
48: }
|