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.MemberOfCheck;
15:
16: /**
17: * @author Sebastian Thomschke
18: */
19: public class MemberOfTest extends AbstractContraintsTest {
20: public void testMemberOf() {
21: final MemberOfCheck check = new MemberOfCheck();
22: super .testCheck(check);
23: assertTrue(check.isSatisfied(null, null, null, null));
24:
25: check.setMembers("10", "false", "TRUE");
26: check.setIgnoreCase(false);
27: assertTrue(check.isSatisfied(null, 10, null, null));
28: assertTrue(check.isSatisfied(null, "10", null, null));
29: assertFalse(check.isSatisfied(null, 10.0, null, null));
30: assertTrue(check.isSatisfied(null, "false", null, null));
31: assertTrue(check.isSatisfied(null, false, null, null));
32: assertTrue(check.isSatisfied(null, "TRUE", null, null));
33: assertFalse(check.isSatisfied(null, true, null, null));
34:
35: check.setIgnoreCase(true);
36: assertTrue(check.isSatisfied(null, "FALSE", null, null));
37: assertTrue(check.isSatisfied(null, false, null, null));
38: assertTrue(check.isSatisfied(null, "true", null, null));
39: assertTrue(check.isSatisfied(null, true, null, null));
40: }
41: }
|