Skip to content

Commit

Permalink
Created unit Tests for PASSPORT Reader
Browse files Browse the repository at this point in the history
  • Loading branch information
eltonlaice committed Aug 30, 2020
1 parent f987350 commit efae8f6
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
2 changes: 1 addition & 1 deletion .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding//src/main/resources=UTF-8
encoding/<project>=UTF-8
48 changes: 48 additions & 0 deletions src/test/java/com/eltonlaice/fromdocs/PassportTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.eltonlaice.fromdocs;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

public class PassportTest {
private String path_file;
private DocumentReader reader;

@Before
public void init() {
this.path_file = "/path/docfile.pdf";
this.reader = new DocumentReader(this.path_file, DocumentType.PASSPORT);
}

@Test
public void testValidFile() {
assertTrue(this.reader.getData().length() > 0);
}

@Test
public void testNumber() {
assertEquals(this.reader.getDocument().getNumber(), "100101111111P");
}

@Test
public void testNames() {
assertEquals(this.reader.getDocument().getLastName(), "LAICE");
assertEquals(this.reader.getDocument().getGivenNames(), "ELTON TOMAS");
}

@Test
public void testBirthdate() {
assertEquals(this.reader.getDocument().getBirthdate().getDayOfMonth(), 8);
assertEquals(this.reader.getDocument().getBirthdate().getMonthValue(), 6);
assertEquals(this.reader.getDocument().getBirthdate().getYear(), 1990);
}

@Test
public void testDateIssue() {
assertEquals(this.reader.getDocument().getDateIssue().getDayOfMonth(), 12);
assertEquals(this.reader.getDocument().getDateIssue().getMonthValue(), 1);
assertEquals(this.reader.getDocument().getDateIssue().getYear(), 2012);
}
}

0 comments on commit efae8f6

Please sign in to comment.