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.LengthCheck;
15:
16: /**
17: * @author Sebastian Thomschke
18: */
19: public class LengthTest extends AbstractContraintsTest {
20: public void testLength() {
21: final LengthCheck check = new LengthCheck();
22: super .testCheck(check);
23: assertTrue(check.isSatisfied(null, null, null, null));
24:
25: check.setMax(5);
26: check.setMin(3);
27: assertEquals(5, check.getMax());
28: assertEquals(3, check.getMin());
29:
30: assertTrue(check.isSatisfied(null, "1234", null, null));
31: assertFalse(check.isSatisfied(null, "12", null, null));
32: assertFalse(check.isSatisfied(null, "", null, null));
33: assertFalse(check.isSatisfied(null, "123456", null, null));
34: }
35: }
|