001: /*******************************************************************************
002: * Portions created by Sebastian Thomschke are copyright (c) 2005-2007 Sebastian
003: * Thomschke.
004: *
005: * All Rights Reserved. This program and the accompanying materials
006: * are made available under the terms of the Eclipse Public License v1.0
007: * which accompanies this distribution, and is available at
008: * http://www.eclipse.org/legal/epl-v10.html
009: *
010: * Contributors:
011: * Sebastian Thomschke - initial implementation.
012: * Makkari - added AssertURLTest
013: *******************************************************************************/package net.sf.oval.test;
014:
015: import junit.extensions.TestSetup;
016: import junit.framework.Test;
017: import junit.framework.TestSuite;
018: import net.sf.oval.Validator;
019: import net.sf.oval.collection.CollectionFactoryJDKImpl;
020: import net.sf.oval.collection.CollectionFactoryJavalutionImpl;
021: import net.sf.oval.collection.CollectionFactoryTroveImpl;
022:
023: /**
024: * @author Sebastian Thomschke
025: */
026: public class AllTests {
027: private static void constraintsTests(final TestSuite suite)
028: throws Exception {
029: suite
030: .addTestSuite(net.sf.oval.test.constraints.AssertTest.class);
031: suite
032: .addTestSuite(net.sf.oval.test.constraints.AssertFalseTest.class);
033: suite
034: .addTestSuite(net.sf.oval.test.constraints.AssertTrueTest.class);
035: suite
036: .addTestSuite(net.sf.oval.test.constraints.FutureTest.class);
037: suite
038: .addTestSuite(net.sf.oval.test.constraints.HasSubStringTest.class);
039: suite
040: .addTestSuite(net.sf.oval.test.constraints.InstanceOfAnyTest.class);
041: suite
042: .addTestSuite(net.sf.oval.test.constraints.InstanceOfTest.class);
043: suite
044: .addTestSuite(net.sf.oval.test.constraints.LengthTest.class);
045: suite.addTestSuite(net.sf.oval.test.constraints.MaxTest.class);
046: suite
047: .addTestSuite(net.sf.oval.test.constraints.MaxLengthTest.class);
048: suite
049: .addTestSuite(net.sf.oval.test.constraints.MaxSizeTest.class);
050: suite
051: .addTestSuite(net.sf.oval.test.constraints.MemberOfTest.class);
052: suite.addTestSuite(net.sf.oval.test.constraints.MinTest.class);
053: suite
054: .addTestSuite(net.sf.oval.test.constraints.MinLengthTest.class);
055: suite
056: .addTestSuite(net.sf.oval.test.constraints.MinSizeTest.class);
057: suite
058: .addTestSuite(net.sf.oval.test.constraints.NoSelfReferenceTest.class);
059: suite
060: .addTestSuite(net.sf.oval.test.constraints.NotBlankTest.class);
061: suite
062: .addTestSuite(net.sf.oval.test.constraints.NotEmptyTest.class);
063: suite
064: .addTestSuite(net.sf.oval.test.constraints.NotEqualTest.class);
065: suite
066: .addTestSuite(net.sf.oval.test.constraints.NotMemberOfTest.class);
067: suite
068: .addTestSuite(net.sf.oval.test.constraints.NotNegativeTest.class);
069: suite
070: .addTestSuite(net.sf.oval.test.constraints.NotNullTest.class);
071: suite.addTestSuite(net.sf.oval.test.constraints.PastTest.class);
072: suite.addTestSuite(net.sf.oval.test.constraints.SizeTest.class);
073: suite
074: .addTestSuite(net.sf.oval.test.constraints.AssertURLTest.class);
075: }
076:
077: private static void guardTests(final TestSuite suite) {
078: suite
079: .addTestSuite(net.sf.oval.test.guard.AddingChecksTest.class);
080: suite
081: .addTestSuite(net.sf.oval.test.guard.ApplyFieldConstraintsToConstructorsTest.class);
082: suite
083: .addTestSuite(net.sf.oval.test.guard.ApplyFieldConstraintsToParametersTest.class);
084: suite
085: .addTestSuite(net.sf.oval.test.guard.ApplyFieldConstraintsToSettersTest.class);
086: suite
087: .addTestSuite(net.sf.oval.test.guard.ConstraintSetTest.class);
088: suite
089: .addTestSuite(net.sf.oval.test.guard.CustomConstraintMessageTest.class);
090: suite
091: .addTestSuite(net.sf.oval.test.guard.ExceptionTranslatorTest.class);
092: suite
093: .addTestSuite(net.sf.oval.test.guard.GuardingWithoutGuardedAnnotationTest.class);
094: suite
095: .addTestSuite(net.sf.oval.test.guard.InheritanceTest.class);
096: suite.addTestSuite(net.sf.oval.test.guard.InnerClassTest.class);
097: suite
098: .addTestSuite(net.sf.oval.test.guard.MethodReturnValueConstraintsValidationTest.class);
099: suite
100: .addTestSuite(net.sf.oval.test.guard.OverridingEqualsTest.class);
101: suite
102: .addTestSuite(net.sf.oval.test.guard.OverridingHashCodeTest.class);
103: suite
104: .addTestSuite(net.sf.oval.test.guard.ParameterConstraintsTest.class);
105: suite
106: .addTestSuite(net.sf.oval.test.guard.PrePostBeanShellTest.class);
107: suite
108: .addTestSuite(net.sf.oval.test.guard.PrePostGroovyTest.class);
109: suite
110: .addTestSuite(net.sf.oval.test.guard.PrePostJavascriptTest.class);
111: suite
112: .addTestSuite(net.sf.oval.test.guard.PrePostMVELTest.class);
113: suite
114: .addTestSuite(net.sf.oval.test.guard.PrePostOGNLTest.class);
115: suite
116: .addTestSuite(net.sf.oval.test.guard.PrePostRubyTest.class);
117: suite
118: .addTestSuite(net.sf.oval.test.guard.PrePostValidateThisTest.class);
119: suite
120: .addTestSuite(net.sf.oval.test.guard.StaticMethodsTest.class);
121: suite
122: .addTestSuite(net.sf.oval.test.guard.XMLConfigurationTest.class);
123: }
124:
125: private static void integrationTests(final TestSuite suite)
126: throws Exception {
127: suite
128: .addTestSuite(net.sf.oval.test.integration.spring.SpringValidatorTest.class);
129: }
130:
131: public static Test suite() throws Exception {
132: // $JUnit-BEGIN$
133: final TestSuite suite = new TestSuite("Test for net.sf.oval");
134:
135: AllTests.constraintsTests(suite);
136:
137: // Tests with JDK collections
138: {
139: final TestSuite suite1 = new TestSuite(
140: "Tests for net.sf.oval with JDK collections");
141: validatorTests(suite1);
142: guardTests(suite1);
143: integrationTests(suite1);
144: final TestSetup setup1 = new TestSetup(suite1) {
145: @Override
146: protected void setUp() throws Exception {
147: super .setUp();
148: Validator
149: .setCollectionFactory(new CollectionFactoryJDKImpl());
150: }
151: };
152: suite.addTest(setup1);
153: }
154:
155: // Tests with Javolution collections
156: {
157: final TestSuite suite1 = new TestSuite(
158: "Tests for net.sf.oval with Javolution collections");
159: validatorTests(suite1);
160: guardTests(suite1);
161: integrationTests(suite1);
162: final TestSetup setup1 = new TestSetup(suite1) {
163: @Override
164: protected void setUp() throws Exception {
165: super .setUp();
166: Validator
167: .setCollectionFactory(new CollectionFactoryJavalutionImpl());
168: }
169: };
170: suite.addTest(setup1);
171: }
172:
173: // Tests with Trove collections
174: {
175: final TestSuite suite1 = new TestSuite(
176: "Tests for net.sf.oval with Trove collections");
177: validatorTests(suite1);
178: guardTests(suite1);
179: integrationTests(suite1);
180: final TestSetup setup1 = new TestSetup(suite1) {
181: @Override
182: protected void setUp() throws Exception {
183: super .setUp();
184: Validator
185: .setCollectionFactory(new CollectionFactoryTroveImpl());
186: }
187: };
188: suite.addTest(setup1);
189: }
190: // $JUnit-END$
191: return suite;
192: }
193:
194: private static void validatorTests(final TestSuite suite) {
195: suite
196: .addTestSuite(net.sf.oval.test.validator.AddingChecksTest.class);
197: suite
198: .addTestSuite(net.sf.oval.test.validator.AssertBeanShellTest.class);
199: suite
200: .addTestSuite(net.sf.oval.test.validator.AssertFieldConstraintsValidationTest.class);
201: suite
202: .addTestSuite(net.sf.oval.test.validator.AssertGroovyTest.class);
203: suite
204: .addTestSuite(net.sf.oval.test.validator.AssertJavascriptTest.class);
205: suite
206: .addTestSuite(net.sf.oval.test.validator.AssertMVELTest.class);
207: suite
208: .addTestSuite(net.sf.oval.test.validator.AssertOGNLTest.class);
209: suite
210: .addTestSuite(net.sf.oval.test.validator.AssertRubyTest.class);
211: suite
212: .addTestSuite(net.sf.oval.test.validator.AssertValidTest.class);
213: suite
214: .addTestSuite(net.sf.oval.test.validator.CheckWithConstraintTest.class);
215: suite
216: .addTestSuite(net.sf.oval.test.validator.ConcurrencyTest.class);
217: suite
218: .addTestSuite(net.sf.oval.test.validator.InvariantMethodConstraintsValidationTest.class);
219: suite
220: .addTestSuite(net.sf.oval.test.validator.InheritanceTest.class);
221: suite
222: .addTestSuite(net.sf.oval.test.validator.JPAAnnotationsConfigurerTest.class);
223: suite
224: .addTestSuite(net.sf.oval.test.validator.ProfilesTest.class);
225: suite
226: .addTestSuite(net.sf.oval.test.validator.SerializationTest.class);
227: suite
228: .addTestSuite(net.sf.oval.test.validator.StaticFieldsAndGettersTest.class);
229: suite
230: .addTestSuite(net.sf.oval.test.validator.ValidateClassWithoutConstraintsTest.class);
231: suite
232: .addTestSuite(net.sf.oval.test.validator.ValidateWithMethodConstraintTest.class);
233: suite
234: .addTestSuite(net.sf.oval.test.validator.ValidatorAssertTest.class);
235: suite
236: .addTestSuite(net.sf.oval.test.validator.XMLConfigurationTest.class);
237: }
238: }
|