Author: hardy.ferentschik
Date: 2009-04-06 11:10:53 -0400 (Mon, 06 Apr 2009)
New Revision: 16264
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserInformation.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserValidator.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/User.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/XmlConfigurationTest.java
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/ValidationMessages.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/AssertTrueValidatorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForCalendarTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForDateTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForStringTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForStringTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NotEmptyValidatorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NullValidatorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/validatorcontext/ConstraintValidatorContextTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolatorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Address.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/GraphNavigationTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Order.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/OrderLine.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Auditable.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CreditCard.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CyclicGroupSequence2.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Order.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceChecker.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceValidator.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountChecker.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountValidator.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ConstraintDescriptorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ElementDescriptorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/PropertyDescriptorTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForNumber.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForString.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/annotationfactory/AnnotationFactoryTest.java
validator/trunk/hibernate-validator/src/test/resources/META-INF/validation/user-constraints.xml
Log:
HV-112
* Reversed the arguments in assertEquals calls
* import cleanup
* code formatting
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/ValidationMessages.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/ValidationMessages.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/ValidationMessages.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -84,12 +84,12 @@
customer.setFirstName( "John" );
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validate( customer );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
customer.setLastName( "Doe" );
constraintViolations = validator.validate( customer );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -106,7 +106,7 @@
customer.setFirstName( "John" );
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validate( customer );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
ConstraintViolation<Customer> constraintViolation =
constraintViolations.iterator().next();
assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
@@ -126,7 +126,7 @@
factory = configuration.buildValidatorFactory();
validator = factory.getValidator();
constraintViolations = validator.validate( customer );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
constraintViolation = constraintViolations.iterator().next();
assertEquals( "my custom message", constraintViolation.getMessage(),
"Wrong message" );
}
@@ -144,7 +144,7 @@
customer.setFirstName( "John" );
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validate( customer );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
ConstraintViolation<Customer> constraintViolation =
constraintViolations.iterator().next();
assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
@@ -164,7 +164,7 @@
factory = configuration.buildValidatorFactory();
validator = factory.getValidator();
constraintViolations = validator.validate( customer );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -265,7 +265,7 @@
customer.setFirstName( "John" );
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validate( customer );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
ConstraintViolation<Customer> constraintViolation =
constraintViolations.iterator().next();
assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
@@ -281,6 +281,6 @@
factory = configuration.buildValidatorFactory();
validator = factory.getValidator();
constraintViolations = validator.validate( customer );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/AssertTrueValidatorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/AssertTrueValidatorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/AssertTrueValidatorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -19,8 +19,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
/**
* @author Alaa Nassef
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForCalendarTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForCalendarTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForCalendarTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -21,8 +21,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
/**
* @author Alaa Nassef
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForDateTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForDateTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/FutureValidatorForDateTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -21,8 +21,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
public class FutureValidatorForDateTest {
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -23,8 +23,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
import org.hibernate.validation.util.annotationfactory.AnnotationDescriptor;
import org.hibernate.validation.util.annotationfactory.AnnotationFactory;
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForStringTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForStringTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForStringTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -21,8 +21,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
import org.hibernate.validation.util.annotationfactory.AnnotationDescriptor;
import org.hibernate.validation.util.annotationfactory.AnnotationFactory;
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -23,8 +23,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
import org.hibernate.validation.util.annotationfactory.AnnotationDescriptor;
import org.hibernate.validation.util.annotationfactory.AnnotationFactory;
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForStringTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForStringTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForStringTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -21,8 +21,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
import org.hibernate.validation.util.annotationfactory.AnnotationDescriptor;
import org.hibernate.validation.util.annotationfactory.AnnotationFactory;
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NotEmptyValidatorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NotEmptyValidatorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NotEmptyValidatorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -19,8 +19,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
/**
* @author Hardy Ferentschik
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NullValidatorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NullValidatorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/NullValidatorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -19,8 +19,8 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import org.testng.annotations.BeforeClass;
/**
* @author Alaa Nassef
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -27,8 +27,8 @@
import javax.validation.Constraint;
import javax.validation.OverridesAttribute;
import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
-import javax.validation.constraints.Pattern;
/**
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/validatorcontext/ConstraintValidatorContextTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/validatorcontext/ConstraintValidatorContextTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/validatorcontext/ConstraintValidatorContextTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -23,9 +23,9 @@
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
-import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
import org.hibernate.validation.util.TestUtil;
@@ -45,7 +45,7 @@
DummyBean bean = new DummyBean( "foobar" );
Set<ConstraintViolation<DummyBean>> constraintViolations =
validator.validate( bean );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
assertEquals( "dummy message", constraintViolation.getMessage(), "Wrong
message" );
}
@@ -64,7 +64,7 @@
DummyBean bean = new DummyBean( "foobar" );
Set<ConstraintViolation<DummyBean>> constraintViolations =
validator.validate( bean );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -79,7 +79,7 @@
DummyBean bean = new DummyBean( "foobar" );
Set<ConstraintViolation<DummyBean>> constraintViolations =
validator.validate( bean );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
assertEquals( "message1", constraintViolation.getMessage(), "Wrong
message" );
assertEquals( "property1", constraintViolation.getPropertyPath(), "Wrong
property" );
@@ -96,7 +96,7 @@
bean.setNestedDummy( new DummyBean( "bar" ) );
Set<ConstraintViolation<DummyBean>> constraintViolations =
validator.validate( bean );
- assertEquals( 2, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 2, "Wrong number of constraints"
);
boolean validatedNestedBean = false;
for ( ConstraintViolation<DummyBean> violation : constraintViolations ) {
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -2,6 +2,7 @@
/**
* Groups including all validations
+ *
* @author Emmanuel Bernard
*/
public interface All {
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -2,7 +2,7 @@
/**
* Group executed first in the validation
- *
+ *
* @author Emmanuel Bernard
*/
public interface First {
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -2,7 +2,7 @@
/**
* Group executed Last in the validation
- *
+ *
* @author Emmanuel Bernard
*/
public interface Last {
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolatorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolatorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolatorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -67,19 +67,19 @@
MessageInterpolator.Context context = new MessageInterpolatorContext( descriptor, null
);
String expected = "replacement worked";
String actual = interpolator.interpolate( "{foo}", context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
expected = "replacement worked replacement worked";
actual = interpolator.interpolate( "{foo} {foo}", context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
expected = "This replacement worked just fine";
actual = interpolator.interpolate( "This {foo} just fine", context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
expected = "{} { replacement worked }";
actual = interpolator.interpolate( "{} { {foo} }", context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
}
@Test
@@ -93,11 +93,11 @@
String expected = "foo"; // missing {}
String actual = interpolator.interpolate( "foo", context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
expected = "#{foo {}";
actual = interpolator.interpolate( "#{foo {}", context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
}
@Test
@@ -111,7 +111,7 @@
String expected = "{bar}"; // unkown token {}
String actual = interpolator.interpolate( "{bar}", context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
}
@Test
@@ -125,7 +125,7 @@
String expected = "may not be null";
String actual = interpolator.interpolate( notNull.message(), context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
ConstraintDescriptorImpl<Size> sizeDescriptor = new
ConstraintDescriptorImpl<Size>(
size, new Class<?>[] { }, new ConstraintHelper()
@@ -133,7 +133,7 @@
expected = "size must be between 0 and 2147483647"; // unkown token {}
context = new MessageInterpolatorContext( sizeDescriptor, null );
actual = interpolator.interpolate( size.message(), context );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
}
@Test
@@ -147,7 +147,7 @@
String expected = "kann nicht null sein";
MessageInterpolator.Context context = new MessageInterpolatorContext( descriptor, null
);
String actual = interpolator.interpolate( notNull.message(), context, Locale.GERMAN );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
}
@Test
@@ -161,7 +161,7 @@
String expected = "may not be null";
String actual = interpolator.interpolate( notNull.message(), context, Locale.JAPAN );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
}
@Test
@@ -175,7 +175,7 @@
String expected = "no puede ser null";
String actual = interpolator.interpolate( notNull.message(), context, new Locale(
"es", "ES" ) );
- assertEquals( expected, actual, "Wrong substitution" );
+ assertEquals( actual, expected, "Wrong substitution" );
}
/**
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -2,7 +2,7 @@
/**
* Group executed second during the validation
- *
+ *
* @author Emmanuel Bernard
*/
public interface Second {
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -139,12 +139,12 @@
customer.setFirstName( "John" );
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validate( customer );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
customer.setLastName( "Doe" );
constraintViolations = validator.validate( customer );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -158,29 +158,29 @@
Set<ConstraintViolation<Address>> constraintViolations =
validator.validate( address );
assertEquals(
+ constraintViolations.size(),
3,
- constraintViolations.size(),
"we should have been 2 not null violation for addresslines and one lenth
violation for city"
);
constraintViolations = validator.validateProperty( address, "city" );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"only city should be validated"
);
constraintViolations = validator.validateProperty( address, "city" );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"only city should be validated"
);
constraintViolations = validator.validateValue( Address.class, "city",
"Paris" );
assertEquals(
+ constraintViolations.size(),
0,
- constraintViolations.size(),
"Paris should be a valid city name."
);
}
@@ -194,17 +194,17 @@
customer.setLastName( "Doe" );
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validate( customer );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
Order order = new Order();
customer.addOrder( order );
constraintViolations = validator.validate( customer );
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
- assertEquals( customer, constraintViolation.getRootBean(), "Wrong root
entity" );
- assertEquals( order.getOrderNumber(), constraintViolation.getInvalidValue(),
"Wrong value" );
+ assertEquals( constraintViolation.getRootBean(), customer, "Wrong root
entity" );
+ assertEquals( constraintViolation.getInvalidValue(), order.getOrderNumber(),
"Wrong value" );
assertEquals( "orderList[0].orderNumber",
constraintViolation.getPropertyPath(), "Wrong propertyName" );
}
@@ -215,15 +215,15 @@
Engine engine = new Engine();
engine.setSerialNumber( "mail(a)foobar.com" );
Set<ConstraintViolation<Engine>> constraintViolations = validator.validate(
engine );
- assertEquals( 2, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 2, "Wrong number of constraints"
);
engine.setSerialNumber( "ABCDEFGH1234" );
constraintViolations = validator.validate( engine );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
engine.setSerialNumber( "ABCD-EFGH-1234" );
constraintViolations = validator.validate( engine );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -244,10 +244,10 @@
Set<ConstraintViolation<Actor>> constraintViolations = validator.validate(
clint );
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( "may not be empty", constraintViolation.getMessage(),
"Wrong message" );
- assertEquals( clint, constraintViolation.getRootBean(), "Wrong root entity"
);
- assertEquals( morgan.getLastName(), constraintViolation.getInvalidValue(), "Wrong
value" );
+ assertEquals( constraintViolation.getRootBean(), clint, "Wrong root entity"
);
+ assertEquals( constraintViolation.getInvalidValue(), morgan.getLastName(), "Wrong
value" );
assertEquals(
"playedWith[0].playedWith[1].lastName",
constraintViolation.getPropertyPath(), "Wrong propertyName"
);
@@ -260,17 +260,17 @@
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validateValue(
Customer.class, "orderList[0].orderNumber", null
);
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
- assertEquals( null, constraintViolation.getRootBean(), "Wrong root entity"
);
- assertEquals( null, constraintViolation.getInvalidValue(), "Wrong value" );
+ assertEquals( constraintViolation.getRootBean(), null, "Wrong root entity"
);
+ assertEquals( constraintViolation.getInvalidValue(), null, "Wrong value" );
assertEquals( "orderList[0].orderNumber",
constraintViolation.getPropertyPath(), "Wrong propertyName" );
constraintViolations = validator.validateValue( Customer.class,
"orderList[0].orderNumber", "1234" );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -313,18 +313,18 @@
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validateProperty(
customer, "orderList[0].orderNumber"
);
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
- assertEquals( customer, constraintViolation.getRootBean(), "Wrong root
entity" );
- assertEquals( order.getOrderNumber(), constraintViolation.getInvalidValue(),
"Wrong value" );
+ assertEquals( constraintViolation.getRootBean(), customer, "Wrong root
entity" );
+ assertEquals( constraintViolation.getInvalidValue(), order.getOrderNumber(),
"Wrong value" );
assertEquals( "orderList[0].orderNumber",
constraintViolation.getPropertyPath(), "Wrong propertyName" );
order.setOrderNumber( 1234 );
constraintViolations = validator.validateProperty( customer,
"orderList[0].orderNumber" );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -385,7 +385,7 @@
Person person = customer;
Set<ConstraintViolation<Person>> constraintViolations = validator.validate(
person );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertConstraintViolation(
constraintViolations.iterator().next(),
@@ -398,7 +398,7 @@
order.setOrderNumber( 123 );
constraintViolations = validator.validate( person );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -417,7 +417,7 @@
Set<ConstraintViolation<Customer>> constraintViolations =
validator.validate(
customer, Default.class, First.class, Second.class, Last.class
);
- assertEquals( 100, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 100, "Wrong number of constraints"
);
}
/**
@@ -431,13 +431,13 @@
PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty(
"orderNumber" );
Set<ConstraintDescriptor<?>> descriptors =
propertyDescriptor.getConstraintDescriptors();
- assertEquals( 1, descriptors.size(), "There should be only one constraint
descriptor" );
+ assertEquals( descriptors.size(), 1, "There should be only one constraint
descriptor" );
ConstraintDescriptor<?> descriptor = descriptors.iterator().next();
Set<Class<?>> groups = descriptor.getGroups();
assertTrue( groups.size() == 1, "There should be only one group" );
assertEquals(
+ groups.iterator().next(),
Default.class,
- groups.iterator().next(),
"The declared constraint does not explicitly define a group, hence Default is
expected"
);
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Address.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Address.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Address.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/GraphNavigationTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/GraphNavigationTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/GraphNavigationTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -61,7 +61,7 @@
Validator validator = TestUtil.getValidator();
Set<ConstraintViolation<Order>> constraintViolations = validator.validate(
order );
- assertEquals( 3, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 3, "Wrong number of constraints"
);
List<String> expectedErrorMessages = new ArrayList<String>();
expectedErrorMessages.add( "shippingAddress.addressline1" );
@@ -85,7 +85,7 @@
Validator validator = TestUtil.getValidator();
Set<ConstraintViolation<User>> constraintViolations = validator.validate(
john );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
TestUtil.assertConstraintViolation(
constraintViolations.iterator().next(), "may not be null", User.class,
null, "lastName"
);
@@ -96,19 +96,19 @@
john.knows( jane );
constraintViolations = validator.validate( john );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
TestUtil.assertConstraintViolation(
constraintViolations.iterator().next(), "may not be null", User.class,
null, "lastName"
);
constraintViolations = validator.validate( jane );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
TestUtil.assertConstraintViolation(
constraintViolations.iterator().next(), "may not be null", User.class,
null, "knowsUser[0].lastName"
);
john.setLastName( "Doe" );
constraintViolations = validator.validate( john );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Order.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Order.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/Order.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/OrderLine.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/OrderLine.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/graphnavigation/OrderLine.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
@@ -17,8 +17,8 @@
*/
package org.hibernate.validation.engine.graphnavigation;
+import javax.validation.Valid;
import javax.validation.constraints.NotNull;
-import javax.validation.Valid;
/**
* @author Hardy Ferentschik
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Auditable.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Auditable.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Auditable.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -26,7 +26,6 @@
import org.hibernate.validation.engine.First;
import org.hibernate.validation.engine.Last;
import org.hibernate.validation.engine.Second;
-import org.hibernate.validation.engine.groups.Author;
/**
* @author Hardy Ferentschik
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CreditCard.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CreditCard.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CreditCard.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CyclicGroupSequence2.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CyclicGroupSequence2.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/CyclicGroupSequence2.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -22,6 +22,6 @@
/**
* @author Hardy Ferentschik
*/
-@GroupSequence( value = CyclicGroupSequence1.class)
+@GroupSequence(value = CyclicGroupSequence1.class)
public interface CyclicGroupSequence2 {
}
\ No newline at end of file
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -20,7 +20,6 @@
import javax.validation.constraints.NotNull;
import org.hibernate.validation.constraints.NotEmpty;
-import org.hibernate.validation.engine.groups.Book;
/**
* @author Hardy Ferentschik
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -83,14 +83,14 @@
groups.add( Last.class );
GroupChain chain = generator.getGroupChainFor( groups );
int count = countGroups( chain );
- assertEquals( 3, count, "Wrong number of groups" );
+ assertEquals( count, 3, "Wrong number of groups" );
groups.clear();
groups.add( First.class );
groups.add( First.class );
chain = generator.getGroupChainFor( groups );
count = countGroups( chain );
- assertEquals( 1, count, "Wrong number of groups" );
+ assertEquals( count, 1, "Wrong number of groups" );
groups.clear();
groups.add( First.class );
@@ -98,7 +98,7 @@
groups.add( First.class );
chain = generator.getGroupChainFor( groups );
count = countGroups( chain );
- assertEquals( 2, count, "Wrong number of groups" );
+ assertEquals( count, 2, "Wrong number of groups" );
}
private int countGroups(GroupChain chain) {
@@ -119,7 +119,7 @@
Iterator<List<Group>> sequences = chain.getSequenceIterator();
List<Group> sequence = sequences.next();
- assertEquals( Default.class, sequence.get( 0 ).getGroup(), "Wrong group" );
- assertEquals( Address.HighLevelCoherence.class, sequence.get( 1 ).getGroup(),
"Wrong group" );
+ assertEquals( sequence.get( 0 ).getGroup(), Default.class, "Wrong group" );
+ assertEquals( sequence.get( 1 ).getGroup(), Address.HighLevelCoherence.class,
"Wrong group" );
}
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -58,28 +58,28 @@
Set<ConstraintViolation<Book>> constraintViolations = validator.validate(
book, First.class, Second.class, Last.class
);
- assertEquals( 3, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 3, "Wrong number of constraints"
);
author.setFirstName( "Gavin" );
author.setLastName( "King" );
constraintViolations = validator.validate( book, First.class, Second.class, Last.class
);
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( "may not be empty", constraintViolation.getMessage(),
"Wrong message" );
- assertEquals( book, constraintViolation.getRootBean(), "Wrong root entity"
);
- assertEquals( book.getTitle(), constraintViolation.getInvalidValue(), "Wrong
value" );
+ assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
+ assertEquals( constraintViolation.getInvalidValue(), book.getTitle(), "Wrong
value" );
assertEquals( "title", constraintViolation.getPropertyPath(), "Wrong
propertyName" );
book.setTitle( "Hibernate Persistence with JPA" );
book.setSubtitle( "Revised Edition of Hibernate in Action" );
constraintViolations = validator.validate( book, First.class, Second.class, Last.class
);
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
constraintViolation = constraintViolations.iterator().next();
assertEquals( "length must be between 0 and 30",
constraintViolation.getMessage(), "Wrong message" );
- assertEquals( book, constraintViolation.getRootBean(), "Wrong root entity"
);
- assertEquals( book.getSubtitle(), constraintViolation.getInvalidValue(), "Wrong
value" );
+ assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
+ assertEquals( constraintViolation.getInvalidValue(), book.getSubtitle(), "Wrong
value" );
assertEquals( "subtitle", constraintViolation.getPropertyPath(), "Wrong
propertyName" );
book.setSubtitle( "Revised Edition" );
@@ -87,16 +87,16 @@
constraintViolations = validator.validate( book, First.class, Second.class, Last.class
);
constraintViolation = constraintViolations.iterator().next();
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( "length must be between 0 and 20",
constraintViolation.getMessage() );
- assertEquals( book, constraintViolation.getRootBean(), "Wrong root entity"
);
- assertEquals( author.getCompany(), constraintViolation.getInvalidValue(), "Wrong
value" );
+ assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
+ assertEquals( constraintViolation.getInvalidValue(), author.getCompany(), "Wrong
value" );
assertEquals( "author.company", constraintViolation.getPropertyPath(),
"Wrong propertyName" );
author.setCompany( "JBoss" );
constraintViolations = validator.validate( book, First.class, Second.class, Last.class
);
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -110,35 +110,35 @@
book.setAuthor( author );
Set<ConstraintViolation<Book>> constraintViolations = validator.validate(
book, Book.All.class );
- assertEquals( 2, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 2, "Wrong number of constraints"
);
author.setFirstName( "Gavin" );
author.setLastName( "King" );
constraintViolations = validator.validate( book, Book.All.class );
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
- assertEquals( book, constraintViolation.getRootBean(), "Wrong root entity"
);
- assertEquals( book.getTitle(), constraintViolation.getInvalidValue(), "Wrong
value" );
+ assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
+ assertEquals( constraintViolation.getInvalidValue(), book.getTitle(), "Wrong
value" );
assertEquals( "title", constraintViolation.getPropertyPath(), "Wrong
propertyName" );
book.setTitle( "Hibernate Persistence with JPA" );
book.setSubtitle( "Revised Edition of Hibernate in Action" );
constraintViolations = validator.validate( book, Book.All.class );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
book.setSubtitle( "Revised Edition" );
author.setCompany( "JBoss a divison of RedHat" );
constraintViolations = validator.validate( book, Book.All.class );
- assertEquals( 1, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
author.setCompany( "JBoss" );
constraintViolations = validator.validate( book, Book.All.class );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -154,7 +154,7 @@
dictonary.setAuthor( author );
Set<ConstraintViolation<Dictonary>> constraintViolations =
validator.validate( dictonary, DefaultAlias.class );
- assertEquals( 0, constraintViolations.size(), "Wrong number of constraints"
);
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
}
@Test
@@ -168,8 +168,8 @@
elepfant, First.class, Second.class
);
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"The should be two invalid constraints since the same propertyName gets
validated in both groups"
);
}
@@ -184,64 +184,64 @@
Set<ConstraintViolation<User>> constraintViolations = validator.validate(
user );
assertEquals(
+ constraintViolations.size(),
2,
- constraintViolations.size(),
"There should be two violations against the implicit default group"
);
constraintViolations = validator.validate( user, Default.class );
assertEquals(
+ constraintViolations.size(),
2,
- constraintViolations.size(),
"There should be two violations against the explicit defualt group"
);
constraintViolations = validator.validate( user, Billable.class );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"There should be one violation against Billable"
);
constraintViolations = validator.validate( user, Default.class, Billable.class );
assertEquals(
+ constraintViolations.size(),
3,
- constraintViolations.size(),
"There should be 3 violation against Default and Billable"
);
constraintViolations = validator.validate( user, BuyInOneClick.class );
assertEquals(
+ constraintViolations.size(),
3,
- constraintViolations.size(),
"Three violations expected since BuyInOneClick extends Default and
Billable"
);
constraintViolations = validator.validate( user, BuyInOneClick.class, Billable.class
);
assertEquals(
+ constraintViolations.size(),
3,
- constraintViolations.size(),
"BuyInOneClick already contains all other groups. Adding Billable does not
change the number of violations"
);
constraintViolations = validator.validate( user, BuyInOneClick.class, Default.class );
assertEquals(
+ constraintViolations.size(),
3,
- constraintViolations.size(),
"BuyInOneClick already contains all other groups. Adding Default does not change
the number of violations"
);
constraintViolations = validator.validate( user, BuyInOneClick.class, Default.class,
Billable.class );
assertEquals(
+ constraintViolations.size(),
3,
- constraintViolations.size(),
"BuyInOneClick already contains all other groups. Adding Billable and Default
does not change the number of violations"
);
constraintViolations = validator.validate( user, Billable.class, Billable.class );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"Adding the same group twice is still only leads to a single violation"
);
}
@@ -262,8 +262,8 @@
user, BuyInOneClick.class, Optional.class
);
assertEquals(
+ constraintViolations.size(),
2,
- constraintViolations.size(),
"There should be two violations against the implicit default group"
);
@@ -305,8 +305,8 @@
Set<ConstraintViolation<Address>> constraintViolations =
validator.validate( address );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"There should only be one violation for zipcode"
);
@@ -318,8 +318,8 @@
// now the second group in the re-defined default group causes an error
constraintViolations = validator.validate( address );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"There should only be one violation for zipcode"
);
@@ -339,8 +339,8 @@
Set<ConstraintViolation<Car>> constraintViolations = validator.validate(
car );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"There should be one violations due to the re-defintion of the default
group"
);
assertEquals(
@@ -351,8 +351,8 @@
constraintViolations = validator.validateProperty( car, "type" );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"There should be one violations due to the re-defintion of the default
group"
);
assertEquals(
@@ -363,8 +363,8 @@
constraintViolations = validator.validateValue( Car.class, "type",
"A" );
assertEquals(
+ constraintViolations.size(),
1,
- constraintViolations.size(),
"There should be one violations due to the re-defintion of the default
group"
);
assertEquals(
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Order.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Order.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Order.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceChecker.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceChecker.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceChecker.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,15 +1,13 @@
package org.hibernate.validation.engine.groups;
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
import java.lang.annotation.Documented;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
import javax.validation.Constraint;
-import org.hibernate.validation.constraints.PatternValidator;
-
/**
* @author Emmanuel Bernard
*/
@@ -19,5 +17,6 @@
@Constraint(validatedBy = ZipCodeCoherenceValidator.class)
public @interface ZipCodeCoherenceChecker {
public abstract String message() default
"{validator.zipCodeCoherenceChecker}";
- public abstract Class<?>[] groups() default {};
+
+ public abstract Class<?>[] groups() default { };
}
\ No newline at end of file
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceValidator.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceValidator.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/ZipCodeCoherenceValidator.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -18,10 +18,7 @@
package org.hibernate.validation.engine.metadata;
import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-import org.hibernate.validation.engine.metadata.Customer;
-
/**
* Class with no constraints but with a cascade @Valid annotation
*/
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountChecker.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountChecker.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountChecker.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
@@ -27,7 +27,6 @@
import javax.validation.Constraint;
-
/**
* @author Hardy Ferentschik
*/
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountValidator.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountValidator.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/AccountValidator.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -76,13 +76,13 @@
BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty(
"orderNumber" );
assertEquals(
- 1, propertyDescriptor.getConstraintDescriptors().size(), "There should be one
constraint descriptor"
+ propertyDescriptor.getConstraintDescriptors().size(), 1, "There should be one
constraint descriptor"
);
beanDescriptor = validator.getConstraintsForClass( Customer.class );
propertyDescriptor = beanDescriptor.getConstraintsForProperty( "orderList"
);
assertEquals(
- 0, propertyDescriptor.getConstraintDescriptors().size(), "There should be no
constraint descriptors"
+ propertyDescriptor.getConstraintDescriptors().size(), 0, "There should be no
constraint descriptors"
);
assertTrue( propertyDescriptor.isCascaded(), "The property should be
cascaded" );
}
@@ -93,7 +93,7 @@
BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Customer.class );
PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty(
"orderList" );
assertEquals(
- 0, propertyDescriptor.getConstraintDescriptors().size(), "There should be no
constraint descriptors"
+ propertyDescriptor.getConstraintDescriptors().size(), 0, "There should be no
constraint descriptors"
);
assertTrue( propertyDescriptor.isCascaded(), "The property should be
cascaded" );
}
@@ -123,7 +123,7 @@
Validator validator = TestUtil.getValidator();
BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
Set<PropertyDescriptor> constraintProperties =
beanDescriptor.getConstrainedProperties();
- assertEquals( 1, constraintProperties.size(), "There should be only one
property" );
+ assertEquals( constraintProperties.size(), 1, "There should be only one
property" );
boolean hasOrderNumber = false;
for ( PropertyDescriptor pd : constraintProperties ) {
hasOrderNumber |= pd.getPropertyName().equals( "orderNumber" );
@@ -164,6 +164,6 @@
Validator validator = TestUtil.getValidator();
BeanDescriptor beanDescriptor = validator.getConstraintsForClass(
UnconstraintEntity.class );
Set<PropertyDescriptor> constraintProperties =
beanDescriptor.getConstrainedProperties();
- assertEquals( 0, constraintProperties.size(), "We should get the empty set."
);
+ assertEquals( constraintProperties.size(), 0, "We should get the empty set."
);
}
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ConstraintDescriptorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ConstraintDescriptorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ConstraintDescriptorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -105,7 +105,7 @@
ConstraintDescriptor<?> descriptor = TestUtil.getSingleConstraintDescriptorFor(
GermanAddress.class, "zipCode"
);
- assertEquals( 1, descriptor.getComposingConstraints().size(), "Wrong number of
composing constraints" );
+ assertEquals( descriptor.getComposingConstraints().size(), 1, "Wrong number of
composing constraints" );
}
@Test
@@ -121,13 +121,13 @@
ConstraintDescriptor<?> descriptor = TestUtil.getSingleConstraintDescriptorFor(
Order.class, "orderNumber" );
Set<Class<?>> groups = descriptor.getGroups();
assertTrue( groups.size() == 1 );
- assertEquals( Default.class, groups.iterator().next(), "Wrong group" );
+ assertEquals( groups.iterator().next(), Default.class, "Wrong group" );
}
@Test
public void testGetConstraintValidatorClasses() {
ConstraintDescriptor<?> descriptor = TestUtil.getSingleConstraintDescriptorFor(
Order.class, "orderNumber" );
- assertEquals( NotNullValidator.class, descriptor.getConstraintValidatorClasses().get( 0
), "Wrong classes" );
+ assertEquals( descriptor.getConstraintValidatorClasses().get( 0 ),
NotNullValidator.class, "Wrong classes" );
}
@Test
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -21,8 +21,8 @@
import java.util.List;
import javax.validation.Valid;
+import org.hibernate.validation.engine.Order;
import org.hibernate.validation.engine.Person;
-import org.hibernate.validation.engine.Order;
/**
* @author Hardy Ferentschik
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ElementDescriptorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ElementDescriptorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/ElementDescriptorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -45,13 +45,13 @@
public void testGetTypeForConstrainedBean() {
Validator validator = TestUtil.getValidator();
BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Customer.class );
- assertEquals( Customer.class, beanDescriptor.getType(), "Wrong type." );
+ assertEquals( beanDescriptor.getType(), Customer.class, "Wrong type." );
}
@Test
public void testGetTypeForConstrainedProperty() {
ElementDescriptor elementDescriptor = TestUtil.getPropertyDescriptor( Order.class,
"orderNumber" );
- assertEquals( Integer.class, elementDescriptor.getType(), "Wrong type." );
+ assertEquals( elementDescriptor.getType(), Integer.class, "Wrong type." );
}
/**
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/PropertyDescriptorTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/PropertyDescriptorTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/PropertyDescriptorTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -48,6 +48,6 @@
public void testPropertyName() {
String propertyName = "orderList";
PropertyDescriptor descriptor = TestUtil.getPropertyDescriptor( Customer.class,
propertyName );
- assertEquals( propertyName, descriptor.getPropertyName(), "Wrong property
name" );
+ assertEquals( descriptor.getPropertyName(), propertyName, "Wrong property
name" );
}
}
\ No newline at end of file
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForNumber.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForNumber.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForNumber.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForString.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForString.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/PostCodeListValidatorForString.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
@@ -29,7 +29,7 @@
}
public boolean isValid(Collection<String> value, ConstraintValidatorContext
constraintValidatorContext) {
- if(value == null) {
+ if ( value == null ) {
return true;
}
return false;
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -84,7 +84,7 @@
Suburb suburb = new Suburb();
List<Integer> postcodes = new ArrayList<Integer>();
- postcodes.add(12345);
+ postcodes.add( 12345 );
suburb.setIncludedPostCodes( postcodes );
// all values are null and should pass
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserInformation.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserInformation.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserInformation.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -0,0 +1,41 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.validation.engine.xml;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Constraint(validatedBy = ConsistentUserValidator.class)
+@Documented
+@Target({ METHOD, FIELD, TYPE })
+@Retention(RUNTIME)
+public @interface ConsistentUserInformation {
+ public abstract String message() default "User information is not
consistent.";
+
+ public abstract Class<?>[] groups() default { };
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserInformation.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserValidator.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserValidator.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserValidator.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -0,0 +1,34 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.validation.engine.xml;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ConsistentUserValidator implements
ConstraintValidator<ConsistentUserInformation, User> {
+
+ public void initialize(ConsistentUserInformation parameters) {
+ }
+
+ public boolean isValid(User user, ConstraintValidatorContext constraintValidatorContext)
{
+ return true;
+ }
+}
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/ConsistentUserValidator.java
___________________________________________________________________
Name: svn:keywords
+ Id
Copied:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/User.java
(from rev 16263,
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/User.java)
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/User.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/User.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -0,0 +1,40 @@
+package org.hibernate.validation.engine.xml;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class User {
+
+ private String firstname;
+
+ //@NotNull(groups = Default.class)
+ private String lastname;
+
+ //@Pattern(regexp = "[0-9 -]?", groups = Optional.class)
+ private String phoneNumber;
+
+
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ public void setPhoneNumber(String phoneNumber) {
+ this.phoneNumber = phoneNumber;
+ }
+}
\ No newline at end of file
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/XmlConfigurationTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/XmlConfigurationTest.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/xml/XmlConfigurationTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -0,0 +1,42 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.validation.engine.xml;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import static org.hibernate.validation.util.TestUtil.assertNumberOfViolations;
+import static org.hibernate.validation.util.TestUtil.getValidator;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class XmlConfigurationTest {
+
+ @Test
+ public void testValidatorResolutionForMinMax() {
+ Validator validator = getValidator();
+
+ User user = new User();
+ Set<ConstraintViolation<User>> constraintViolations = validator.validate(
user );
+ assertNumberOfViolations( constraintViolations, 1 );
+ }
+}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -93,11 +93,11 @@
map.put( key, testObject );
Object value = ReflectionHelper.getIndexedValue( map, key );
- assertEquals( testObject, value, "We should be able to retrieve the indexed
object" );
+ assertEquals( value, testObject, "We should be able to retrieve the indexed
object" );
// try to get to the value by integer index
value = ReflectionHelper.getIndexedValue( map, "0" );
- assertEquals( testObject, value, "We should be able to retrieve the indexed
object" );
+ assertEquals( value, testObject, "We should be able to retrieve the indexed
object" );
value = ReflectionHelper.getIndexedValue( map, "foo" );
assertNull( value, "A non existent index should return the null value" );
@@ -113,7 +113,7 @@
list.add( testObject );
Object value = ReflectionHelper.getIndexedValue( list, "0" );
- assertEquals( testObject, value, "We should be able to retrieve the indexed
object" );
+ assertEquals( value, testObject, "We should be able to retrieve the indexed
object" );
value = ReflectionHelper.getIndexedValue( list, "2" );
assertNull( value, "A non existent index should return the null value" );
@@ -144,7 +144,7 @@
assertEquals( "test", message, "Wrong message" );
Class<?>[] group = ReflectionHelper.getAnnotationParameter( testAnnotation,
"groups", Class[].class );
- assertEquals( Default.class, group[0], "Wrong message" );
+ assertEquals( group[0], Default.class, "Wrong message" );
try {
ReflectionHelper.getAnnotationParameter( testAnnotation, "message",
Integer.class );
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -73,8 +73,8 @@
public static void assertConstraintViolation(ConstraintViolation violation, String
errorMessage, Class rootBean, Object invalidValue, String propertyPath, Class leafBean) {
assertEquals(
+ violation.getLeafBean().getClass(),
leafBean,
- violation.getLeafBean().getClass(),
"Wrong leaf bean type"
);
assertConstraintViolation( violation, errorMessage, rootBean, invalidValue,
propertyPath );
@@ -82,8 +82,8 @@
public static void assertConstraintViolation(ConstraintViolation violation, String
errorMessage, Class rootBean, Object invalidValue, String propertyPath) {
assertEquals(
+ violation.getPropertyPath(),
propertyPath,
- violation.getPropertyPath(),
"Wrong propertyPath"
);
assertConstraintViolation( violation, errorMessage, rootBean, invalidValue );
@@ -91,8 +91,8 @@
public static void assertConstraintViolation(ConstraintViolation violation, String
errorMessage, Class rootBean, Object invalidValue) {
assertEquals(
+ violation.getInvalidValue(),
invalidValue,
- violation.getInvalidValue(),
"Wrong invalid value"
);
assertConstraintViolation( violation, errorMessage, rootBean );
@@ -100,18 +100,18 @@
public static void assertConstraintViolation(ConstraintViolation violation, String
errorMessage, Class rootBean) {
assertEquals(
+ violation.getRootBean().getClass(),
rootBean,
- violation.getRootBean().getClass(),
"Wrong root bean type"
);
assertConstraintViolation( violation, errorMessage );
}
public static void assertConstraintViolation(ConstraintViolation violation, String
message) {
- assertEquals( message, violation.getMessage(), "Wrong message" );
+ assertEquals( violation.getMessage(), message, "Wrong message" );
}
public static void assertNumberOfViolations(Set violations, int expectedViolations) {
- assertEquals( expectedViolations, violations.size(), "Wrong number of constraint
violations" );
+ assertEquals( violations.size(), expectedViolations, "Wrong number of constraint
violations" );
}
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/annotationfactory/AnnotationFactoryTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/annotationfactory/AnnotationFactoryTest.java 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/annotationfactory/AnnotationFactoryTest.java 2009-04-06
15:10:53 UTC (rev 16264)
@@ -37,8 +37,8 @@
Size size = AnnotationFactory.create( descriptor );
- assertEquals( 5, size.min(), "Wrong parameter value" );
- assertEquals( 10, size.max(), "Wrong parameter value" );
+ assertEquals( size.min(), 5, "Wrong parameter value" );
+ assertEquals( size.max(), 10, "Wrong parameter value" );
}
@Test(expectedExceptions = IllegalArgumentException.class)
Modified:
validator/trunk/hibernate-validator/src/test/resources/META-INF/validation/user-constraints.xml
===================================================================
---
validator/trunk/hibernate-validator/src/test/resources/META-INF/validation/user-constraints.xml 2009-04-05
18:12:23 UTC (rev 16263)
+++
validator/trunk/hibernate-validator/src/test/resources/META-INF/validation/user-constraints.xml 2009-04-06
15:10:53 UTC (rev 16264)
@@ -1,8 +1,23 @@
<constraint-mappings
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping
validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
-
<default-package>org.hibernate.validation.engine.groups</default-package>
+ <default-package>org.hibernate.validation.engine.xml</default-package>
<bean class="User" ignore-annotations="false">
+ <class ignore-annotations="false">
+ <group-sequence>
+ <value>value0</value>
+ </group-sequence>
+ <constraint
annotation="org.hibernate.validation.engine.xml.ConsistentUserInformation">
+ <message>message0</message>
+ <groups>
+ <value>foo</value>
+ </groups>
+ <element name="name1">
+ </element>
+ <element name="name3">
+ </element>
+ </constraint>
+ </class>
<field name="firstName">
<constraint annotation="com.acme.app.constraint.LooksLike">
<element name="patterns">