1 package org.nuiton.validator.xwork2.field;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import org.junit.Test;
26 import org.nuiton.validator.model.HealthEstablishment;
27
28
29
30
31 public class FrenchFinessFieldValidatorTest extends AbstractFieldValidatorTest<HealthEstablishment> {
32
33 public FrenchFinessFieldValidatorTest() {
34 super(HealthEstablishment.class);
35 }
36
37 @Test
38 @Override
39 public void testValidator() throws Exception {
40 assertNull(bean.getFiness());
41
42
43 bean.setFiness("440012664");
44 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
45 false);
46
47
48 bean.setFiness("310001177");
49 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
50 false);
51
52
53 bean.setFiness("2A0002879");
54 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
55 false);
56
57
58 bean.setFiness("2B0000236");
59 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
60 false);
61
62
63 bean.setFiness("2B01");
64 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
65 true);
66
67
68 bean.setFiness("4402345636");
69 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
70 true);
71
72
73 bean.setFiness("CC0123456");
74 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
75 true);
76
77
78 bean.setFiness("000123456");
79 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
80 true);
81
82
83 bean.setFiness("441B23456");
84 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
85 true);
86
87
88 bean.setFiness("4402345F6");
89 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
90 true);
91
92
93 bean.setFiness("440012666");
94 assertFieldInError(HealthEstablishment.PROPERTY_FINESS, "healthEstablishment.finess.format",
95 true);
96
97 }
98 }