Test for compile failure if attributes don't match.
[JSR 303 TCK Result] 117 of 257 (45.53%) Pass with 14 Failures and 8 Errors.
Review at http://gwt-code-reviews.appspot.com/1384803
Review by: rchandia@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9856 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionCompileTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionCompileTest.java
index f4637a8..338b25a 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionCompileTest.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionCompileTest.java
@@ -24,6 +24,7 @@
import org.hibernate.jsr303.tck.util.TckCompileTestCase;
+import javax.validation.ConstraintDefinitionException;
import javax.validation.UnexpectedTypeException;
/**
@@ -53,4 +54,30 @@
MustBeApplicableValidatorFactory.MustBeApplicableValidator.class,
Shoe.class);
}
+
+ /**
+ * Replacement for
+ * {@link ConstraintCompositionTest#testOverriddenAttributesMustMatchInType()}
+ *
+ * @throws UnableToCompleteException
+ */
+ public void testOverriddenAttributesMustMatchInType()
+ throws UnableToCompleteException {
+ UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
+ builder.expect(Type.ERROR, "Unable to create a validator for "
+ + "org.hibernate.jsr303.tck.tests.constraints.constraintcomposition."
+ + "ConstraintCompositionTest.DummyEntityWithZipCode "
+ + "because The overriding type of a composite constraint must be "
+ + "identical to the overridden one. "
+ + "Expected int found class java.lang.String",
+ ConstraintDefinitionException.class);
+ builder.setLowestLogLevel(Type.INFO);
+ UnitTestTreeLogger testLogger = builder.createLogger();
+ assertModuleFails(
+ testLogger,
+ getFullyQaulifiedModuleName(getClass(),
+ "OverriddenAttributesMustMatchInTypeTest"),
+ OverriddenAttributesMustMatchInTypeValidatorFactory.OverriddenAttributesMustMatchInTypeValidator.class);
+ }
+
}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
index 5fee2ac..859183a 100644
--- a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
@@ -56,11 +56,6 @@
delegate.testOnlySingleConstraintViolation();
}
- @Failing(issue = 5799)
- public void testOverriddenAttributesMustMatchInType() {
- delegate.testOverriddenAttributesMustMatchInType();
- }
-
public void testPayloadPropagationInComposedConstraints() {
delegate.testPayloadPropagationInComposedConstraints();
}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeTest.gwt.xml b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeTest.gwt.xml
new file mode 100644
index 0000000..95895a8
--- /dev/null
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeTest.gwt.xml
@@ -0,0 +1,27 @@
+<?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>
+ <replace-with class="org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.OverriddenAttributesMustMatchInTypeValidatorFactory">
+ <when-type-is class="javax.validation.ValidatorFactory"/>
+ </replace-with>
+</module>
\ No newline at end of file
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeValidatorFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeValidatorFactory.java
new file mode 100644
index 0000000..04be602
--- /dev/null
+++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeValidatorFactory.java
@@ -0,0 +1,32 @@
+package org.hibernate.jsr303.tck.tests.constraints.constraintcomposition;
+
+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.constraintcomposition.ConstraintCompositionTest.DummyEntityWithZipCode;
+
+import javax.validation.Validator;
+
+/**
+ * {@link AbstractGwtValidatorFactory} implementation that uses
+ * {@link com.google.gwt.validation.client.GwtValidation GwtValidation}.
+ */
+public final class OverriddenAttributesMustMatchInTypeValidatorFactory extends
+ AbstractGwtValidatorFactory {
+
+ /**
+ * Validator for
+ * {@link ConstraintCompositionTest#testOverriddenAttributesMustMatchInType()}
+ */
+ @GwtValidation(value = {DummyEntityWithZipCode.class})
+ public static interface OverriddenAttributesMustMatchInTypeValidator extends
+ Validator {
+ }
+
+ @Override
+ public AbstractGwtValidator createValidator() {
+ return GWT.create(OverriddenAttributesMustMatchInTypeValidator.class);
+ }
+}
\ No newline at end of file
diff --git a/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java b/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
index 71740ac..dd7f4da 100644
--- a/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
+++ b/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
@@ -39,7 +39,7 @@
@Override
protected void gwtTearDown() throws Exception {
- BeanHelper.clearBeanHelpersForTests();
+ BeanHelper.clearBeanHelpersForTests();
super.gwtTearDown();
}