1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.nuiton.validator;
23
24 import org.junit.Assert;
25 import org.junit.Test;
26 import org.nuiton.validator.model.Person;
27 import org.nuiton.validator.xwork2.XWork2NuitonValidatorProvider;
28
29 import java.util.Map;
30
31
32
33
34
35
36
37 public class NuitonValidatorFactoryTest {
38
39 @Test
40 public void testGetProviders() throws Exception {
41 Map<String, NuitonValidatorProvider> providers = NuitonValidatorFactory.getProviders();
42 Assert.assertNotNull(providers);
43 Assert.assertEquals(1, providers.size());
44 Assert.assertTrue(providers.containsKey(XWork2NuitonValidatorProvider.PROVIDER_NAME));
45 Assert.assertTrue(providers.get(XWork2NuitonValidatorProvider.PROVIDER_NAME) instanceof XWork2NuitonValidatorProvider);
46 }
47
48 @Test
49 public void testNewValidator() throws Exception {
50
51 NuitonValidator<Person> validator =
52 NuitonValidatorFactory.newValidator(Person.class);
53
54 ValidatorTestHelper.testPerson(validator);
55 }
56
57 }