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.validator;
13:
14: import java.util.List;
15:
16: import junit.framework.TestCase;
17: import net.sf.oval.ConstraintViolation;
18: import net.sf.oval.Validator;
19: import net.sf.oval.configuration.xml.XMLConfigurer;
20:
21: /**
22: * @author Sebastian Thomschke
23: */
24: public class ValidateClassWithoutConstraintsTest extends TestCase {
25: protected static class TestEntity {
26: protected String name;
27:
28: private TestEntity(final String name) {
29: this .name = name;
30: }
31:
32: /**
33: * @param name the name to set
34: */
35: public void setName(final String name) {
36: this .name = name;
37: }
38: }
39:
40: public void testClassWithoutConstraints() {
41: final TestEntity e = new TestEntity(null);
42:
43: final Validator v = new Validator();
44: List<ConstraintViolation> violations = v.validate(e);
45: assertEquals(0, violations.size());
46: }
47:
48: public void testEmptyXmlConfigurer() {
49: XMLConfigurer xmlConfigurer = new XMLConfigurer();
50: Validator v = new Validator(xmlConfigurer);
51:
52: final TestEntity e = new TestEntity(null);
53:
54: List<ConstraintViolation> violations = v.validate(e);
55: assertEquals(0, violations.size());
56: }
57: }
|