-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created unit Tests for PASSPORT Reader
- Loading branch information
1 parent
f987350
commit efae8f6
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |