|
3 | 3 | import com.fasterxml.jackson.databind.JavaType;
|
4 | 4 | import com.fasterxml.jackson.databind.ObjectMapper;
|
5 | 5 | import com.mindee.parsing.common.Document;
|
6 |
| -import com.mindee.parsing.common.Page; |
7 | 6 | import com.mindee.parsing.common.PredictResponse;
|
| 7 | +import com.mindee.parsing.standard.ClassificationField; |
| 8 | +import com.mindee.product.ProductTestHelper; |
8 | 9 | import org.junit.jupiter.api.Assertions;
|
9 | 10 | import org.junit.jupiter.api.Test;
|
10 | 11 | import java.io.File;
|
11 | 12 | import java.io.IOException;
|
12 |
| -import java.nio.file.Files; |
13 |
| -import java.nio.file.Paths; |
14 |
| -import java.util.List; |
15 | 13 |
|
16 | 14 | /**
|
17 | 15 | * Unit tests for BankAccountDetailsV1.
|
@@ -45,27 +43,10 @@ void whenEmptyDeserialized_mustHaveValidProperties() throws IOException {
|
45 | 43 | void whenCompleteDeserialized_mustHaveValidDocumentSummary() throws IOException {
|
46 | 44 | PredictResponse<BankAccountDetailsV1> response = getPrediction("complete");
|
47 | 45 | Document<BankAccountDetailsV1> doc = response.getDocument();
|
48 |
| - String[] actualLines = doc.toString().split(System.lineSeparator()); |
49 |
| - List<String> expectedLines = Files.readAllLines( |
50 |
| - Paths.get("src/test/resources/products/bank_account_details/response_v1/summary_full.rst") |
| 46 | + ProductTestHelper.assertStringEqualsFile( |
| 47 | + doc.toString(), |
| 48 | + "src/test/resources/products/bank_account_details/response_v1/summary_full.rst" |
51 | 49 | );
|
52 |
| - String expectedSummary = String.join(String.format("%n"), expectedLines); |
53 |
| - String actualSummary = String.join(String.format("%n"), actualLines); |
54 |
| - |
55 |
| - Assertions.assertEquals(expectedSummary, actualSummary); |
56 | 50 | }
|
57 | 51 |
|
58 |
| - @Test |
59 |
| - void whenCompleteDeserialized_mustHaveValidPage0Summary() throws IOException { |
60 |
| - PredictResponse<BankAccountDetailsV1> response = getPrediction("complete"); |
61 |
| - Page<BankAccountDetailsV1Document> page = response.getDocument().getInference().getPages().get(0); |
62 |
| - String[] actualLines = page.toString().split(System.lineSeparator()); |
63 |
| - List<String> expectedLines = Files.readAllLines( |
64 |
| - Paths.get("src/test/resources/products/bank_account_details/response_v1/summary_page0.rst") |
65 |
| - ); |
66 |
| - String expectedSummary = String.join(String.format("%n"), expectedLines); |
67 |
| - String actualSummary = String.join(String.format("%n"), actualLines); |
68 |
| - |
69 |
| - Assertions.assertEquals(expectedSummary, actualSummary); |
70 |
| - } |
71 | 52 | }
|
0 commit comments