Author: hardy.ferentschik
Date: 2009-06-17 08:29:46 -0400 (Wed, 17 Jun 2009)
New Revision: 16819
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/configuration/MappingStreamHandlingTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java
Log:
Added missing builtin constraint tests.
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/configuration/MappingStreamHandlingTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/configuration/MappingStreamHandlingTest.java 2009-06-17
12:29:31 UTC (rev 16818)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/configuration/MappingStreamHandlingTest.java 2009-06-17
12:29:46 UTC (rev 16819)
@@ -31,6 +31,8 @@
import static org.testng.FileAssert.fail;
import org.testng.annotations.Test;
+import static org.hibernate.jsr303.tck.util.TestUtil.getInputStreamForPath;
+
/**
* @author Hardy Ferentschik
*/
@@ -39,7 +41,6 @@
destination =
"WEB-INF/classes/org/hibernate/jsr303/tck/tests/configuration/empty-constraints.xml")
public class MappingStreamHandlingTest extends AbstractTest {
-
@Test
@SpecAssertion(section = "4.4.3", id = "b")
public void testMappingStreamGetsClosed() {
@@ -82,17 +83,6 @@
}
}
- private InputStream getInputStreamForPath(String path) {
- // try the context class loader first
- InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream( path );
-
- // try the current class loader
- if ( inputStream == null ) {
- inputStream = this.getClass().getResourceAsStream( path );
- }
- return inputStream;
- }
-
public class DelegatingInputStream extends InputStream {
boolean closeHasBeenCalled = false;
final InputStream delegate;
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java 2009-06-17
12:29:31 UTC (rev 16818)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java 2009-06-17
12:29:46 UTC (rev 16819)
@@ -128,7 +128,7 @@
// Set<ConstraintDescriptor<?>> descriptors = getConstraintDescriptorsFor(
Order.class, "orderNumber" );
// assertTrue( descriptors.size() == 1, "There should only by one descriptor."
);
// ConstraintDescriptor<?> descriptor = descriptors.iterator().next();
-// assertEquals( descriptor.getConstraintValidatorClasses().get( 0 ),
NotNullValidator.class, "Wrong classes" );
+// assertEquals( descriptor.getConstraintValidatorClasses().get( 0 ),
InvertedNotNullValidator.class, "Wrong classes" );
// }
@Test
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java 2009-06-17
12:29:31 UTC (rev 16818)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java 2009-06-17
12:29:46 UTC (rev 16819)
@@ -17,16 +17,17 @@
*/
package org.hibernate.jsr303.tck.util;
+import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.ConstraintViolation;
import javax.validation.metadata.ElementDescriptor;
import javax.validation.metadata.PropertyDescriptor;
-import javax.validation.Validation;
-import javax.validation.Validator;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@@ -121,4 +122,15 @@
ElementDescriptor elementDescriptor = getPropertyDescriptor( clazz, property );
return elementDescriptor.getConstraintDescriptors();
}
+
+ public static InputStream getInputStreamForPath(String path) {
+ // try the context class loader first
+ InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream( path );
+
+ // try the current class loader
+ if ( inputStream == null ) {
+ inputStream = TestUtil.class.getResourceAsStream( path );
+ }
+ return inputStream;
+ }
}
Show replies by date