Пример #1
0
  @Test
  public void testParseOldIdentityFile() throws Exception {
    // setup
    final InputStream inputStream = TlvParserTest.class.getResourceAsStream("/old-eid.txt");
    final byte[] base64IdentityData = IOUtils.toByteArray(inputStream);
    final byte[] identityData = Base64.decodeBase64(base64IdentityData);

    // operate
    final Identity identity = TlvParser.parse(identityData, Identity.class);

    // verify
    LOG.debug("name: " + identity.getName());
    LOG.debug("first name: " + identity.getFirstName());
    LOG.debug("document type: " + identity.getDocumentType());
    LOG.debug("card validity date begin: " + identity.getCardValidityDateBegin().getTime());
    assertEquals(DocumentType.BELGIAN_CITIZEN, identity.getDocumentType());
  }
Пример #2
0
  @Test
  public void testForeignerIdentityFile() throws Exception {
    // setup
    final InputStream inputStream = TlvParserTest.class.getResourceAsStream("/id-foreigner.tlv");
    final byte[] identityData = IOUtils.toByteArray(inputStream);

    // operate
    final Identity identity = TlvParser.parse(identityData, Identity.class);

    // verify
    LOG.debug("name: " + identity.getName());
    LOG.debug("first name: " + identity.getFirstName());
    LOG.debug("document type: " + identity.getDocumentType());
    assertEquals(DocumentType.FOREIGNER_E_PLUS, identity.getDocumentType());
    assertNotNull(identity.getDuplicate());
    LOG.debug("duplicate: " + identity.getDuplicate());
    LOG.debug("special organisation: \"" + identity.getSpecialOrganisation() + "\"");
    assertEquals(SpecialOrganisation.UNSPECIFIED, identity.getSpecialOrganisation());
  }