Author: hardy.ferentschik
Date: 2009-06-15 09:34:25 -0400 (Mon, 15 Jun 2009)
New Revision: 16786
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ValidatorTypeTest.java
Log:
Tests updates
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-06-15
09:39:23 UTC (rev 16785)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java 2009-06-15
13:34:25 UTC (rev 16786)
@@ -37,7 +37,7 @@
import org.hibernate.validation.engine.ConstraintValidatorFactoryImpl;
import org.hibernate.validation.engine.HibernateValidatorConfiguration;
import org.hibernate.validation.engine.ValidatorFactoryImpl;
-import org.hibernate.validation.engine.metadata.Customer;
+import org.hibernate.validation.engine.Customer;
/**
* Tests the Bean Validation bootstrapping.
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java 2009-06-15
13:34:25 UTC (rev 16786)
@@ -0,0 +1,70 @@
+// $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;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.validation.Valid;
+
+import org.hibernate.validation.engine.Order;
+import org.hibernate.validation.engine.Person;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Customer implements Person {
+
+ private String firstName;
+ private String middleName;
+ private String lastName;
+
+ @Valid
+ private List<Order> orderList = new ArrayList<Order>();
+
+ public void addOrder(Order order) {
+ orderList.add( order );
+ }
+
+ public List<Order> getOrderList() {
+ return orderList;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getMiddleName() {
+ return middleName;
+ }
+
+ public void setMiddleName(String middleName) {
+ this.middleName = middleName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+}
\ No newline at end of file
Property changes on:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
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-06-15
09:39:23 UTC (rev 16785)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java 2009-06-15
13:34:25 UTC (rev 16786)
@@ -32,7 +32,6 @@
import static org.testng.Assert.fail;
import org.testng.annotations.Test;
-import org.hibernate.validation.engine.metadata.Customer;
import org.hibernate.validation.util.LoggerFactory;
import org.hibernate.validation.util.TestUtil;
import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ValidatorTypeTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ValidatorTypeTest.java 2009-06-15
09:39:23 UTC (rev 16785)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ValidatorTypeTest.java 2009-06-15
13:34:25 UTC (rev 16786)
@@ -24,10 +24,11 @@
import javax.validation.ConstraintValidator;
import static org.testng.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
import org.testng.annotations.Test;
-import org.hibernate.validation.constraints.composition.FrenchZipcode;
-import
org.hibernate.validation.constraints.composition.FrenchZipcodeConstraintValidator;
+import org.hibernate.validation.constraints.custom.Positive;
+import org.hibernate.validation.constraints.custom.PositiveConstraintValidator;
/**
* Tests for message resolution.
@@ -38,11 +39,13 @@
@Test
public void testTypeDiscovery() {
- List<Class<? extends ConstraintValidator<FrenchZipcode, ?>>>
validators =
- new ArrayList<Class<? extends ConstraintValidator<FrenchZipcode,
?>>>();
- validators.add( FrenchZipcodeConstraintValidator.class );
+ List<Class<? extends ConstraintValidator<Positive, ?>>> validators =
+ new ArrayList<Class<? extends ConstraintValidator<Positive,
?>>>();
+ validators.add( PositiveConstraintValidator.class );
Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorsTypes
= ValidatorTypeHelper
.getValidatorsTypes( validators );
- assertEquals( FrenchZipcodeConstraintValidator.class, validatorsTypes.get( String.class
) );
+
+ assertEquals( validatorsTypes.get( Integer.class ), PositiveConstraintValidator.class
);
+ assertNull( validatorsTypes.get( String.class ) );
}
}
\ No newline at end of file