Пример #1
0
  @Test
  public void testHCard() throws Exception {
    // setup
    final InputStream inputStream = TlvParserTest.class.getResourceAsStream("/h-card.tlv");
    final byte[] identityData = IOUtils.toByteArray(inputStream);

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

    // verify
    LOG.debug("document type: " + identity.getDocumentType());
    assertEquals(DocumentType.EUROPEAN_BLUE_CARD_H, identity.getDocumentType());
    LOG.debug("duplicate: " + identity.getDuplicate());
    assertEquals("01", identity.getDuplicate());
    assertTrue(identity.isMemberOfFamily());
    LOG.debug("special organisation: \"" + identity.getSpecialOrganisation() + "\"");
    assertEquals(SpecialOrganisation.UNSPECIFIED, identity.getSpecialOrganisation());
  }
Пример #2
0
  @Test
  public void testDuplicate02() throws Exception {
    // setup
    final InputStream inputStream = TlvParserTest.class.getResourceAsStream("/duplicate-02.tlv");
    final byte[] identityData = IOUtils.toByteArray(inputStream);

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

    // verify
    LOG.debug("document type: " + identity.getDocumentType());
    assertEquals(DocumentType.FOREIGNER_A, identity.getDocumentType());
    LOG.debug("duplicate: " + identity.getDuplicate());
    assertEquals("02", identity.getDuplicate());
    LOG.debug("member of family: " + identity.isMemberOfFamily());
    assertTrue(identity.isMemberOfFamily());
    LOG.debug("special organisation: \"" + identity.getSpecialOrganisation() + "\"");
    assertEquals(SpecialOrganisation.RESEARCHER, identity.getSpecialOrganisation());
  }
Пример #3
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());
  }
Пример #4
0
  @Test
  public void testParseNewIdentityFile() throws Exception {
    // setup
    final InputStream inputStream = TlvParserTest.class.getResourceAsStream("/new-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("card validity date begin: " + identity.getCardValidityDateBegin().getTime());
    LOG.debug("document type: " + identity.getDocumentType());
    assertEquals(DocumentType.BELGIAN_CITIZEN, identity.getDocumentType());
    assertNull(identity.getDuplicate());
    assertFalse(identity.isMemberOfFamily());
  }