Add test for Invalid Constraint Definitions. [JSR 303 TCK Result] 152 of 257 (59.14%) Pass with 23 Failures and 7 Errors. Review at http://gwt-code-reviews.appspot.com/1505806 Review by: rchandia@google.com git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10496 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/validation/tck/InvalidConstraintDefinitionsGwtSuite.java b/user/test/com/google/gwt/validation/tck/InvalidConstraintDefinitionsGwtSuite.java new file mode 100644 index 0000000..4eebed1 --- /dev/null +++ b/user/test/com/google/gwt/validation/tck/InvalidConstraintDefinitionsGwtSuite.java
@@ -0,0 +1,33 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.validation.tck; + +import junit.framework.Test; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsCompileTest; +import org.hibernate.jsr303.tck.util.TckTestSuiteWrapper; + +/** + * Tck Tests for the {@code constraints invalidconstraintdefinitions} package. + */ +public class InvalidConstraintDefinitionsGwtSuite { + public static Test suite() { + TckTestSuiteWrapper suite = new TckTestSuiteWrapper( + "TCK for GWT Validation, constraints invalidconstraintdefinitions package"); + suite.addTestSuite(InvalidConstraintDefinitionsCompileTest.class); + return suite; + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithParameterStartingWithValidFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithParameterStartingWithValidFactory.java new file mode 100644 index 0000000..35020a7 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithParameterStartingWithValidFactory.java
@@ -0,0 +1,48 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityValidProperty; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithParameterStartingWithValid() + * )} + */ +public final class ConstraintDefinitionWithParameterStartingWithValidFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithParameterStartingWithValid()} + */ + @GwtValidation(value = {DummyEntityValidProperty.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongDefaultGroupValueFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongDefaultGroupValueFactory.java new file mode 100644 index 0000000..69e552f --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongDefaultGroupValueFactory.java
@@ -0,0 +1,48 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityInvalidDefaultGroup; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongDefaultGroupValue() + * )} + */ +public final class ConstraintDefinitionWithWrongDefaultGroupValueFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongDefaultGroupValue()} + */ + @GwtValidation(value = {DummyEntityInvalidDefaultGroup.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongDefaultPayloadValueFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongDefaultPayloadValueFactory.java new file mode 100644 index 0000000..ceb9eb4 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongDefaultPayloadValueFactory.java
@@ -0,0 +1,48 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityInvalidDefaultPayload; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongDefaultPayloadValue() + * )} + */ +public final class ConstraintDefinitionWithWrongDefaultPayloadValueFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongDefaultPayloadValue()} + */ + @GwtValidation(value = {DummyEntityInvalidDefaultPayload.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongGroupTypeFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongGroupTypeFactory.java new file mode 100644 index 0000000..8165345 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongGroupTypeFactory.java
@@ -0,0 +1,48 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityInvalidGroupsType; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongGroupType() + * )} + */ +public final class ConstraintDefinitionWithWrongGroupTypeFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongGroupType()} + */ + @GwtValidation(value = {DummyEntityInvalidGroupsType.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongMessageTypeFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongMessageTypeFactory.java new file mode 100644 index 0000000..d45a1d4 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongMessageTypeFactory.java
@@ -0,0 +1,48 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityInvalidMessageType; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongMessageType() + * )} + */ +public final class ConstraintDefinitionWithWrongMessageTypeFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongMessageType()} + */ + @GwtValidation(value = {DummyEntityInvalidMessageType.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongPayloadClassFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongPayloadClassFactory.java new file mode 100644 index 0000000..6b17fbf --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithWrongPayloadClassFactory.java
@@ -0,0 +1,48 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityInvalidPayloadClass; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongPayloadClass() + * )} + */ +public final class ConstraintDefinitionWithWrongPayloadClassFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithWrongPayloadClass()} + */ + @GwtValidation(value = {DummyEntityInvalidPayloadClass.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutGroupParameterFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutGroupParameterFactory.java new file mode 100644 index 0000000..a159290 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutGroupParameterFactory.java
@@ -0,0 +1,48 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.groups.DefaultGroupRedefinitionTest; +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityNoGroups; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithoutGroupParameter()} + */ +public final class ConstraintDefinitionWithoutGroupParameterFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link DefaultGroupRedefinitionTest#testGroupSequenceContainingDefault()} + */ + @GwtValidation(value = {DummyEntityNoGroups.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutMessageParameterFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutMessageParameterFactory.java new file mode 100644 index 0000000..d656950 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutMessageParameterFactory.java
@@ -0,0 +1,47 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityNoMessage; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithoutMessageParameter()} + */ +public final class ConstraintDefinitionWithoutMessageParameterFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithoutMessageParameter()} + */ + @GwtValidation(value = {DummyEntityNoMessage.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutPayloadParameterFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutPayloadParameterFactory.java new file mode 100644 index 0000000..f58b959 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/ConstraintDefinitionWithoutPayloadParameterFactory.java
@@ -0,0 +1,47 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest.DummyEntityNoPayload; + +import javax.validation.Validator; + +/** + * ValidatorFactory for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithoutPayloadParameter()} + */ +public final class ConstraintDefinitionWithoutPayloadParameterFactory extends + AbstractGwtValidatorFactory { + + /** + * Validator for + * {@link InvalidConstraintDefinitionsTest#testConstraintDefinitionWithoutPayloadParameter()} + */ + @GwtValidation(value = {DummyEntityNoPayload.class}) + public static interface TestValidator extends + Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(TestValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidConstraintDefinitionsCompileTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidConstraintDefinitionsCompileTest.java new file mode 100644 index 0000000..6430498 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/InvalidConstraintDefinitionsCompileTest.java
@@ -0,0 +1,147 @@ +/* + * Copyright 2011 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions; + +import org.hibernate.jsr303.tck.util.TckCompileTestCase; + +import javax.validation.ConstraintDefinitionException; +import javax.validation.Validator; + +/** + * Test wrapper for + * {@link org.hibernate.jsr303.tck.tests.constraints.invalidconstraintdefinitions.InvalidConstraintDefinitionsTest} + * . + */ +public class InvalidConstraintDefinitionsCompileTest extends TckCompileTestCase { + + public void testConstraintDefinitionWithoutGroupParameter() { + assertConstraintDefinitionException( + ConstraintDefinitionWithoutGroupParameterFactory.TestValidator.class, + "Unable to create a validator for org.hibernate.jsr303.tck." + + "tests.constraints.invalidconstraintdefinitions." + + "InvalidConstraintDefinitionsTest.DummyEntityNoGroups because " + + "org.hibernate.jsr303.tck.tests.constraints." + + "invalidconstraintdefinitions.NoGroups contains Constraint " + + "annotation, but does not contain a groups parameter."); + } + + public void testConstraintDefinitionWithoutMessageParameter() { + assertConstraintDefinitionException( + ConstraintDefinitionWithoutMessageParameterFactory.TestValidator.class, + "Unable to create a validator for " + + "org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions." + + "InvalidConstraintDefinitionsTest" + + ".DummyEntityNoMessage because " + + "org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions" + + ".NoMessage contains Constraint annotation, " + + "but does not contain a message parameter."); + } + + public void testConstraintDefinitionWithoutPayloadParameter() { + assertConstraintDefinitionException( + ConstraintDefinitionWithoutPayloadParameterFactory.TestValidator.class, + "Unable to create a validator for org.hibernate.jsr303.tck.tests" + + ".constraints.invalidconstraintdefinitions" + + ".InvalidConstraintDefinitionsTest" + + ".DummyEntityNoPayload because org.hibernate.jsr303.tck.tests" + + ".constraints.invalidconstraintdefinitions.NoPayload contains " + + "Constraint annotation, but does not contain a payload " + + "parameter."); + } + + public void testConstraintDefinitionWithParameterStartingWithValid() { + assertConstraintDefinitionException( + ConstraintDefinitionWithParameterStartingWithValidFactory.TestValidator.class, + "Unable to create a validator for org.hibernate.jsr303.tck.tests" + + ".constraints.invalidconstraintdefinitions" + + ".InvalidConstraintDefinitionsTest.DummyEntityValidProperty " + + "because Parameters starting with 'valid' are not allowed in a constraint."); + } + + public void testConstraintDefinitionWithWrongDefaultGroupValue() { + assertConstraintDefinitionException( + ConstraintDefinitionWithWrongDefaultGroupValueFactory.TestValidator.class, + "Unable to create a validator for " + + "org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions.InvalidConstraintDefinitionsTest" + + ".DummyEntityInvalidDefaultGroup " + + "because org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions" + + ".InvalidDefaultGroup contains Constraint annotation, " + + "but the groups parameter default value is not the empty array."); + } + + public void testConstraintDefinitionWithWrongDefaultPayloadValue() { + assertConstraintDefinitionException( + ConstraintDefinitionWithWrongDefaultPayloadValueFactory.TestValidator.class, + "Unable to create a validator for org.hibernate.jsr303.tck.tests" + + ".constraints.invalidconstraintdefinitions" + + ".InvalidConstraintDefinitionsTest" + + ".DummyEntityInvalidDefaultPayload " + + "because org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions.InvalidDefaultPayload contains " + + "Constraint annotation, but the payload parameter default " + + "value is not the empty array."); + } + + public void testConstraintDefinitionWithWrongGroupType() { + assertConstraintDefinitionException( + ConstraintDefinitionWithWrongGroupTypeFactory.TestValidator.class, + "Unable to create a validator for org.hibernate.jsr303.tck.tests" + + ".constraints.invalidconstraintdefinitions" + + ".InvalidConstraintDefinitionsTest" + + ".DummyEntityInvalidGroupsType because " + + "org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions.InvalidGroupsType " + + "contains Constraint annotation, but the groups " + + "parameter is of wrong type."); + } + + public void testConstraintDefinitionWithWrongMessageType() { + assertConstraintDefinitionException( + ConstraintDefinitionWithWrongMessageTypeFactory.TestValidator.class, + "Unable to create a validator for org.hibernate.jsr303.tck.tests" + + ".constraints" + + ".invalidconstraintdefinitions.InvalidConstraintDefinitionsTest" + + ".DummyEntityInvalidMessageType because " + + "org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions.InvalidMessageType " + + "contains Constraint annotation, " + + "but the message parameter is not of type java.lang.String."); + } + + public void testConstraintDefinitionWithWrongPayloadClass() { + assertConstraintDefinitionException( + ConstraintDefinitionWithWrongPayloadClassFactory.TestValidator.class, + "Unable to create a validator for " + + "org.hibernate.jsr303.tck.tests" + + ".constraints.invalidconstraintdefinitions" + + ".InvalidConstraintDefinitionsTest.DummyEntityInvalidPayloadClass " + + "because org.hibernate.jsr303.tck.tests.constraints" + + ".invalidconstraintdefinitions.InvalidPayloadClass " + + "contains Constraint annotation, " + + "but the payload parameter is of wrong type."); + } + + private void assertConstraintDefinitionException( + final Class<? extends Validator> validatorClass, + final String expectedMessage) { + assertValidatorFailsToCompile(validatorClass, + ConstraintDefinitionException.class, expectedMessage); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/TckTest.gwt.xml b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/TckTest.gwt.xml new file mode 100644 index 0000000..678091e --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/invalidconstraintdefinitions/TckTest.gwt.xml
@@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd"> +<!-- + Copyright 2010 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy of + the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +--> +<module> + <inherits name="org.hibernate.jsr303.tck.tests.ValidationTck" /> + <source path=""> + <include name="*.java" /> + <exclude name="*CompileTest.java" /> + </source> +</module> \ No newline at end of file
diff --git a/user/test/org/hibernate/jsr303/tck/util/TckGeneratorTestUtils.java b/user/test/org/hibernate/jsr303/tck/util/TckGeneratorTestUtils.java index 970a3c8..be10ee6 100644 --- a/user/test/org/hibernate/jsr303/tck/util/TckGeneratorTestUtils.java +++ b/user/test/org/hibernate/jsr303/tck/util/TckGeneratorTestUtils.java
@@ -15,8 +15,6 @@ */ package org.hibernate.jsr303.tck.util; -import com.google.gwt.core.ext.Generator; -import com.google.gwt.core.ext.GeneratorContext; import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.core.ext.linker.ArtifactSet; @@ -28,8 +26,6 @@ import com.google.gwt.dev.util.log.CompositeTreeLogger; import com.google.gwt.dev.util.log.PrintWriterTreeLogger; -import junit.framework.Assert; - import java.io.File; import javax.validation.ValidationException;