1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.agent;
|
11
|
|
12
|
import java.util.Set;
|
13
|
|
14
|
import javax.validation.ConstraintViolation;
|
15
|
import javax.validation.Validation;
|
16
|
import javax.validation.Validator;
|
17
|
import javax.validation.ValidatorFactory;
|
18
|
|
19
|
import org.junit.BeforeClass;
|
20
|
import org.junit.Test;
|
21
|
|
22
|
/**
|
23
|
* @author b.clark
|
24
|
*
|
25
|
*/
|
26
|
public class AgentValidationTest {
|
27
|
|
28
|
private static Validator validator;
|
29
|
|
30
|
@BeforeClass
|
31
|
public static void onSetUp() throws Exception {
|
32
|
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
|
33
|
validator = factory.getValidator();
|
34
|
}
|
35
|
|
36
|
@Test
|
37
|
public void testNullTitleCache() {
|
38
|
Person person = Person.NewInstance();
|
39
|
Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person);
|
40
|
|
41
|
for(ConstraintViolation<Person> constraintViolation : constraintViolations) {
|
42
|
System.out.println(constraintViolation.getMessage());
|
43
|
}
|
44
|
}
|
45
|
}
|