예제 #1
0
  @Test
  public void identityWithAddressKml() throws Exception {
    // setup
    Identity identity = new Identity();
    identity.name = "Test Name";
    identity.firstName = "Test First name";
    identity.dateOfBirth = new GregorianCalendar();
    identity.gender = Gender.MALE;

    Address address = new Address();
    address.streetAndNumber = "Test Street 1A";
    address.zip = "1234";
    address.municipality = "Test Municipality";

    EIdData eIdData = new EIdData();
    eIdData.identity = identity;
    eIdData.address = address;

    // operate
    byte[] document = this.testedInstance.generateKml(eIdData);

    // verify
    assertNotNull(document);
    assertTrue(document.length > 0);

    toTmpFile(document);
  }
예제 #2
0
  @Test
  public void identityWithAddressAndPhotoKml() throws Exception {
    // setup
    Identity identity = new Identity();
    identity.name = "Test Name";
    identity.firstName = "Test First name";
    identity.dateOfBirth = new GregorianCalendar();
    identity.gender = Gender.MALE;

    Address address = new Address();
    address.streetAndNumber = "Test Street 1A";
    address.zip = "1234";
    address.municipality = "Test Municipality";

    BufferedImage image = new BufferedImage(140, 200, BufferedImage.TYPE_INT_RGB);
    Graphics2D graphics = (Graphics2D) image.getGraphics();
    RenderingHints renderingHints =
        new RenderingHints(
            RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    graphics.setRenderingHints(renderingHints);
    graphics.setColor(Color.WHITE);
    graphics.fillRect(1, 1, 140 - 1 - 1, 200 - 1 - 1);
    graphics.setFont(new Font("Dialog", Font.BOLD, 20));
    graphics.setColor(Color.BLACK);
    graphics.drawString("Test Photo", 0, 200 / 2);
    graphics.dispose();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ImageIO.write(image, "jpg", baos);
    byte[] photo = baos.toByteArray();

    EIdData eIdData = new EIdData();
    eIdData.identity = identity;
    eIdData.address = address;
    eIdData.photo = photo;

    // operate
    byte[] document = this.testedInstance.generateKml(eIdData);

    // verify
    assertNotNull(document);
    assertTrue(document.length > 0);

    toTmpFile(document);
  }
예제 #3
0
  @Test
  public void identityKml() throws Exception {
    // setup
    Identity identity = new Identity();
    identity.name = "Test Name";
    identity.firstName = "Test First name";
    identity.dateOfBirth = new GregorianCalendar();
    identity.gender = Gender.MALE;
    EIdData eIdData = new EIdData();
    eIdData.identity = identity;

    // operate
    byte[] document = this.testedInstance.generateKml(eIdData);

    // verify
    assertNotNull(document);
    assertTrue(document.length > 0);

    toTmpFile(document);
  }