|
|
@@ -19,12 +19,24 @@ public class LuhnValidatorTest {
|
|
19
|
19
|
|
|
20
|
20
|
@Ignore
|
|
21
|
21
|
@Test
|
|
22
|
|
- public void testThatAValidCanadianSocialInsuranceNumberIsIdentifiedAsValid() {
|
|
|
22
|
+ public void testThatASimpleValidCanadianSocialInsuranceNumberIsIdentifiedAsValid() {
|
|
|
23
|
+ assertTrue(new LuhnValidator().isValid(" 5 9 "));
|
|
|
24
|
+ }
|
|
|
25
|
+
|
|
|
26
|
+ @Ignore
|
|
|
27
|
+ @Test
|
|
|
28
|
+ public void testThatAComplexValidCanadianSocialInsuranceNumberIsIdentifiedAsValidV1() {
|
|
23
|
29
|
assertTrue(new LuhnValidator().isValid("046 454 286"));
|
|
24
|
30
|
}
|
|
25
|
31
|
|
|
26
|
32
|
@Ignore
|
|
27
|
33
|
@Test
|
|
|
34
|
+ public void testThatAComplexValidCanadianSocialInsuranceNumberIsIdentifiedAsValidV2() {
|
|
|
35
|
+ assertTrue(new LuhnValidator().isValid("055 444 285"));
|
|
|
36
|
+ }
|
|
|
37
|
+
|
|
|
38
|
+ @Ignore
|
|
|
39
|
+ @Test
|
|
28
|
40
|
public void testThatAnInvalidCanadianSocialInsuranceNumberIsIdentifiedAsInvalid() {
|
|
29
|
41
|
assertFalse(new LuhnValidator().isValid("046 454 287"));
|
|
30
|
42
|
}
|
|
|
@@ -41,4 +53,34 @@ public class LuhnValidatorTest {
|
|
41
|
53
|
assertFalse(new LuhnValidator().isValid("046a 454 286"));
|
|
42
|
54
|
}
|
|
43
|
55
|
|
|
|
56
|
+ @Ignore
|
|
|
57
|
+ @Test
|
|
|
58
|
+ public void testThatStringContainingPunctuationIsInvalid() {
|
|
|
59
|
+ assertFalse(new LuhnValidator().isValid("055-444-285"));
|
|
|
60
|
+ }
|
|
|
61
|
+
|
|
|
62
|
+ @Ignore
|
|
|
63
|
+ @Test
|
|
|
64
|
+ public void testThatStringContainingSymbolsIsInvalid() {
|
|
|
65
|
+ assertFalse(new LuhnValidator().isValid("055£ 444$ 285"));
|
|
|
66
|
+ }
|
|
|
67
|
+
|
|
|
68
|
+ @Ignore
|
|
|
69
|
+ @Test
|
|
|
70
|
+ public void testThatTheStringConsistingOfASpaceAndASingleZeroIsInvalid() {
|
|
|
71
|
+ assertFalse(new LuhnValidator().isValid(" 0"));
|
|
|
72
|
+ }
|
|
|
73
|
+
|
|
|
74
|
+ @Ignore
|
|
|
75
|
+ @Test
|
|
|
76
|
+ public void testThatStringContainingMultipleZerosIsValid() {
|
|
|
77
|
+ assertTrue(new LuhnValidator().isValid(" 00000"));
|
|
|
78
|
+ }
|
|
|
79
|
+
|
|
|
80
|
+ @Ignore
|
|
|
81
|
+ @Test
|
|
|
82
|
+ public void testThatDoublingNineIsHandledCorrectly() {
|
|
|
83
|
+ assertTrue(new LuhnValidator().isValid("091"));
|
|
|
84
|
+ }
|
|
|
85
|
+
|
|
44
|
86
|
}
|