@Test public void testIdentityFileDoBYearOnlyWithSpaces() throws Exception { // setup final byte[] idFile = new byte[] {12, 12, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '1', '9', '6', '2'}; // operate final Identity identity = TlvParser.parse(idFile, Identity.class); // verify assertNotNull(identity.getDateOfBirth()); LOG.debug("date of birth: " + identity.getDateOfBirth().getTime()); assertEquals(1962, identity.getDateOfBirth().get(Calendar.YEAR)); assertEquals(0, identity.getDateOfBirth().get(Calendar.MONTH)); assertEquals(1, identity.getDateOfBirth().get(Calendar.DAY_OF_MONTH)); }
@Test public void testGermanIdentityFileDoB() throws Exception { // setup final byte[] idFileCaseInTheField = new byte[] {12, 12, '2', '3', '.', 'S', 'E', 'P', '.', ' ', '1', '9', '8', '2'}; // operate final Identity identity = TlvParser.parse(idFileCaseInTheField, Identity.class); // verify assertNotNull(identity.getDateOfBirth()); LOG.debug("date of birth: " + identity.getDateOfBirth().getTime()); final byte[] idFile = new byte[] {12, 11, '2', '3', '.', 'S', 'E', 'P', '.', '1', '9', '8', '2'}; final Identity identity2 = TlvParser.parse(idFile, Identity.class); assertEquals(identity.getDateOfBirth(), identity2.getDateOfBirth()); }
@Test public void testYearOnlyDate() throws Exception { final byte[] yearOnlyTLV = new byte[] {12, 4, '1', '9', '8', '4'}; final Identity identity = TlvParser.parse(yearOnlyTLV, Identity.class); assertEquals(1984, identity.getDateOfBirth().get(Calendar.YEAR)); }