Skip to content

Commit

Permalink
Merge pull request #9 from veryfi/feature/LP-399-fix-test
Browse files Browse the repository at this point in the history
LP-399: Fix unit tests
  • Loading branch information
alejouribesanchez authored Mar 29, 2023
2 parents 991e6e3 + 2d7cf59 commit 1854f2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions src/test/kotlin/com/veryfi/kotlin/ClientTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class ClientTest {
`when`(httpResponse.statusCode()).thenReturn(200)
`when`(httpResponse.body()).thenReturn(result)
}
val jsonResponse = client.processDocument("receipt.jpg", categories, false, null)
val path = ClassLoader.getSystemResource("receipt.jpg").path
val jsonResponse = client.processDocument(path, categories, false, null)
val document = JSONObject(jsonResponse)
Assertions.assertEquals("Walgreens", document.getJSONObject("vendor").getString("name"))
}
Expand All @@ -111,7 +112,8 @@ class ClientTest {
`when`(httpResponse.statusCode()).thenReturn(200)
`when`(httpResponse.body()).thenReturn(result)
}
val jsonResponse = client.processDocument("receipt.jpg", categories, false, parameters)
val path = ClassLoader.getSystemResource("receipt.jpg").path
val jsonResponse = client.processDocument(path, categories, false, parameters)
val document = JSONObject(jsonResponse)
Assertions.assertEquals("Walgreens", document.getJSONObject("vendor").getString("name"))
}
Expand All @@ -129,7 +131,9 @@ class ClientTest {
`when`(httpResponse.statusCode()).thenReturn(200)
`when`(httpResponse.body()).thenReturn(result)
}
val jsonResponse = client.processDocument("receipt.jpg", null, false, null)

val path = ClassLoader.getSystemResource("receipt.jpg").path
val jsonResponse = client.processDocument(path, null, false, null)
val document = JSONObject(jsonResponse)
Assertions.assertEquals("Walgreens", document.getJSONObject("vendor").getString("name"))
}
Expand Down Expand Up @@ -198,7 +202,7 @@ class ClientTest {
null
)
val document = JSONObject(jsonResponse)
Assertions.assertEquals("Rumpke", document.getJSONObject("vendor").getString("name"))
Assertions.assertEquals("Rumpke Of Ohio", document.getJSONObject("vendor").getString("name"))
}

@Test
Expand Down Expand Up @@ -226,7 +230,7 @@ class ClientTest {
parameters
)
val document = JSONObject(jsonResponse)
Assertions.assertEquals("Rumpke", document.getJSONObject("vendor").getString("name"))
Assertions.assertEquals("Rumpke Of Ohio", document.getJSONObject("vendor").getString("name"))
}

@Test
Expand Down Expand Up @@ -291,7 +295,8 @@ class ClientTest {
`when`(httpResponse.statusCode()).thenReturn(200)
`when`(httpResponse.body()).thenReturn(result)
}
val jsonResponseFuture = client.processDocumentAsync("receipt.jpg", categories, false, null)
val path = ClassLoader.getSystemResource("receipt.jpg").path
val jsonResponseFuture = client.processDocumentAsync(path, categories, false, null)
val jsonResponse = jsonResponseFuture.get()
val document = JSONObject(jsonResponse)
Assertions.assertEquals("Walgreens", document.getJSONObject("vendor").getString("name"))
Expand Down Expand Up @@ -372,7 +377,7 @@ class ClientTest {
)
val jsonResponse = jsonResponseFuture.get()
val document = JSONObject(jsonResponse)
Assertions.assertEquals("Rumpke", document.getJSONObject("vendor").getString("name"))
Assertions.assertEquals("Rumpke Of Ohio", document.getJSONObject("vendor").getString("name"))
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/processDocumentUrl.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"vendor":{
"address":"3800 Struble Rd, Cincinnati, OH 45251, United States",
"fax_number":"",
"name":"Rumpke",
"name":"Rumpke Of Ohio",
"phone_number":"(800) 828-8171",
"raw_name":"RUMPKE",
"vendor_logo":"https://cdn.veryfi.com/logos/tmp/346683478.png",
Expand Down

0 comments on commit 1854f2e

Please sign in to comment.