11package com .yoti .api .client .spi .remote ;
22
3+ import static org .hamcrest .MatcherAssert .assertThat ;
4+ import static org .hamcrest .Matchers .*;
35import static org .junit .Assert .assertEquals ;
46import static org .junit .Assert .assertNotNull ;
57import static org .junit .Assert .assertNull ;
810
911import com .yoti .api .client .DocumentDetails ;
1012
13+ import com .yoti .api .client .spi .remote .call .YotiConstants ;
1114import org .junit .Test ;
1215
1316public class DocumentDetailsAttributeParserTest {
1417
18+ private static final String SOME_AADHAR_DOCUMENT_DETAILS = "NATIONAL_ID IND ********6421 - UIDAI" ;
19+
1520 DocumentDetailsAttributeParser testObj = new DocumentDetailsAttributeParser ();
1621
1722 @ Test (expected = IllegalArgumentException .class )
@@ -24,16 +29,6 @@ public void shouldThrowExceptionWhenAttributesAreMissing() throws Exception {
2429 testObj .parseFrom ("PASSPORT GBR" );
2530 }
2631
27- @ Test (expected = IllegalArgumentException .class )
28- public void shouldThrowExceptionForInvalidNumber () throws Exception {
29- testObj .parseFrom ("PASSPORT GBR $%^$%^£ 2016-05-01" );
30- }
31-
32- @ Test (expected = IllegalArgumentException .class )
33- public void shouldThrowExceptionForInvalidCountry () throws Exception {
34- testObj .parseFrom ("PASSPORT 13 1234abc 2016-05-01" );
35- }
36-
3732 @ Test
3833 public void shouldParseMandatoryAttributes () throws Exception {
3934 DocumentDetails result = testObj .parseFrom ("PASSPORT GBR 1234abc" );
@@ -99,4 +94,16 @@ public void shouldThrowExceptionForInvalidDate() throws Exception {
9994 testObj .parseFrom ("PASSPORT GBR 1234abc" + " X016-05-01" );
10095 }
10196
97+ @ Test
98+ public void shouldParseRedactedAadhar () throws Exception {
99+ DocumentDetails result = testObj .parseFrom (SOME_AADHAR_DOCUMENT_DETAILS );
100+
101+ assertThat (result , is (notNullValue ()));
102+ assertThat (result .getType (), is ("NATIONAL_ID" ));
103+ assertThat (result .getIssuingCountry (), is ("IND" ));
104+ assertThat (result .getDocumentNumber (), is ("********6421" ));
105+ assertThat (result .getExpirationDate (), is (nullValue ()));
106+ assertThat (result .getIssuingAuthority (), is ("UIDAI" ));
107+ }
108+
102109}
0 commit comments