Author: hardy.ferentschik
Date: 2009-06-22 11:05:32 -0400 (Mon, 22 Jun 2009)
New Revision: 16860
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateValueTest.java
Log:
Updated tests for validateValue and validateProperty
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyTest.java 2009-06-22
14:48:50 UTC (rev 16859)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatePropertyTest.java 2009-06-22
15:05:32 UTC (rev 16860)
@@ -147,34 +147,34 @@
assertCorrectNumberOfViolations( constraintViolations, 0 );
}
-// @Test
-// @SpecAssertions({
-// @SpecAssertion(section = "4.1.1", id = "d"),
-// @SpecAssertion(section = "4.1.1", id = "c")
-// })
-// public void testValidatePropertyWithIndexedPath() {
-// Validator validator = TestUtil.getDefaultValidator();
-//
-// ActorListBased clint = new ActorListBased( "Clint", "Eastwood"
);
-// ActorListBased morgan = new ActorListBased( "Morgan", null );
-// ActorListBased charlie = new ActorListBased( "Charlie", "Sheen"
);
-//
-// clint.addPlayedWith( charlie );
-// charlie.addPlayedWith( clint );
-// charlie.addPlayedWith( morgan );
-// morgan.addPlayedWith( charlie );
-// morgan.addPlayedWith( clint );
-// clint.addPlayedWith( morgan );
-//
-// String property = "playedWith[0].playedWith[1].lastName";
-// Set<ConstraintViolation<ActorListBased>> constraintViolations =
validator.validateProperty(
-// clint, property
-// );
-// assertCorrectNumberOfViolations( constraintViolations, 1 );
-//
-// ConstraintViolation<ActorListBased> violation =
constraintViolations.iterator().next();
-// assertCorrectConstraintType( violation, NotNull.class );
-// assertConstraintViolation( violation, ActorListBased.class, null, property );
-// assertCorrectConstraintViolationMessage( violation, "Everyone has a last
name." );
-// }
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "4.1.1", id = "d"),
+ @SpecAssertion(section = "4.1.1", id = "c")
+ })
+ public void testValidatePropertyWithIndexedPath() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ ActorListBased clint = new ActorListBased( "Clint", "Eastwood" );
+ ActorListBased morgan = new ActorListBased( "Morgan", null );
+ ActorListBased charlie = new ActorListBased( "Charlie", "Sheen" );
+
+ clint.addPlayedWith( charlie );
+ charlie.addPlayedWith( clint );
+ charlie.addPlayedWith( morgan );
+ morgan.addPlayedWith( charlie );
+ morgan.addPlayedWith( clint );
+ clint.addPlayedWith( morgan );
+
+ String property = "playedWith[0].playedWith[1].lastName";
+ Set<ConstraintViolation<ActorListBased>> constraintViolations =
validator.validateProperty(
+ clint, property
+ );
+ assertCorrectNumberOfViolations( constraintViolations, 1 );
+
+ ConstraintViolation<ActorListBased> violation =
constraintViolations.iterator().next();
+ assertCorrectConstraintType( violation, NotNull.class );
+ assertConstraintViolation( violation, ActorListBased.class, null, property );
+ assertCorrectConstraintViolationMessage( violation, "Everyone has a last
name." );
+ }
}
\ No newline at end of file
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateValueTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateValueTest.java 2009-06-22
14:48:50 UTC (rev 16859)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateValueTest.java 2009-06-22
15:05:32 UTC (rev 16860)
@@ -166,7 +166,7 @@
fail();
}
catch ( IllegalArgumentException e ) {
- assertEquals( "Invalid property path.", e.getMessage() );
+ // success
}
try {
@@ -174,7 +174,7 @@
fail();
}
catch ( IllegalArgumentException e ) {
- assertEquals( "Invalid property path.", e.getMessage() );
+ // success
}
try {
@@ -182,7 +182,7 @@
fail();
}
catch ( IllegalArgumentException e ) {
- assertEquals( "Invalid property path.", e.getMessage() );
+ // success
}
}
}
\ No newline at end of file
Show replies by date