|
39 | 39 | import static com.azure.ai.formrecognizer.TestUtils.CONTENT_FORM_JPG; |
40 | 40 | import static com.azure.ai.formrecognizer.TestUtils.CONTENT_GERMAN_PDF; |
41 | 41 | import static com.azure.ai.formrecognizer.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; |
42 | | -import static com.azure.ai.formrecognizer.TestUtils.INVALID_IMAGE_URL_ERROR_CODE; |
43 | 42 | import static com.azure.ai.formrecognizer.TestUtils.INVALID_SOURCE_URL_ERROR_CODE; |
44 | 43 | import static com.azure.ai.formrecognizer.TestUtils.INVALID_URL; |
45 | 44 | import static com.azure.ai.formrecognizer.TestUtils.NON_EXIST_MODEL_ID; |
@@ -278,15 +277,11 @@ public void recognizeReceiptFromUrlWithEncodedBlankSpaceSourceUrl(HttpClient htt |
278 | 277 | public void recognizeReceiptInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { |
279 | 278 | client = getFormRecognizerAsyncClient(httpClient, serviceVersion); |
280 | 279 | invalidSourceUrlRunner((invalidSourceUrl) -> { |
281 | | - HttpResponseException errorResponseException = assertThrows(HttpResponseException.class, |
| 280 | + assertThrows(HttpResponseException.class, |
282 | 281 | () -> client.beginRecognizeReceiptsFromUrl(invalidSourceUrl) |
283 | | - .setPollInterval(durationTestMode) |
284 | | - .getSyncPoller() |
285 | | - .getFinalResult()); |
286 | | - |
287 | | - FormRecognizerErrorInformation errorInformation |
288 | | - = (FormRecognizerErrorInformation) errorResponseException.getValue(); |
289 | | - assertEquals(INVALID_IMAGE_URL_ERROR_CODE, errorInformation.getErrorCode()); |
| 282 | + .setPollInterval(durationTestMode) |
| 283 | + .getSyncPoller() |
| 284 | + .getFinalResult()); |
290 | 285 | }); |
291 | 286 | } |
292 | 287 |
|
@@ -610,12 +605,9 @@ public void recognizeContentFromUrlWithPdf(HttpClient httpClient, FormRecognizer |
610 | 605 | public void recognizeContentInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { |
611 | 606 | client = getFormRecognizerAsyncClient(httpClient, serviceVersion); |
612 | 607 | invalidSourceUrlRunner((invalidSourceUrl) -> { |
613 | | - HttpResponseException errorResponseException = assertThrows(HttpResponseException.class, |
| 608 | + assertThrows(HttpResponseException.class, |
614 | 609 | () -> client.beginRecognizeContentFromUrl(invalidSourceUrl) |
615 | 610 | .setPollInterval(durationTestMode).getSyncPoller().getFinalResult()); |
616 | | - FormRecognizerErrorInformation errorInformation = |
617 | | - (FormRecognizerErrorInformation) errorResponseException.getValue(); |
618 | | - assertEquals(INVALID_IMAGE_URL_ERROR_CODE, errorInformation.getErrorCode()); |
619 | 611 | }); |
620 | 612 | } |
621 | 613 |
|
@@ -1714,15 +1706,11 @@ public void recognizeBusinessCardInvalidSourceUrl(HttpClient httpClient, |
1714 | 1706 | FormRecognizerServiceVersion serviceVersion) { |
1715 | 1707 | client = getFormRecognizerAsyncClient(httpClient, serviceVersion); |
1716 | 1708 | invalidSourceUrlRunner((invalidSourceUrl) -> { |
1717 | | - HttpResponseException errorResponseException = assertThrows(HttpResponseException.class, |
| 1709 | + assertThrows(HttpResponseException.class, |
1718 | 1710 | () -> client.beginRecognizeBusinessCardsFromUrl(invalidSourceUrl) |
1719 | 1711 | .setPollInterval(durationTestMode) |
1720 | 1712 | .getSyncPoller() |
1721 | 1713 | .getFinalResult()); |
1722 | | - |
1723 | | - FormRecognizerErrorInformation errorInformation = |
1724 | | - (FormRecognizerErrorInformation) errorResponseException.getValue(); |
1725 | | - assertEquals(INVALID_IMAGE_URL_ERROR_CODE, errorInformation.getErrorCode()); |
1726 | 1714 | }); |
1727 | 1715 | } |
1728 | 1716 |
|
@@ -2253,15 +2241,10 @@ public void recognizeLicenseSourceUrl(HttpClient httpClient, FormRecognizerServi |
2253 | 2241 | public void recognizeIDDocumentInvalidSourceUrl(HttpClient httpClient, |
2254 | 2242 | FormRecognizerServiceVersion serviceVersion) { |
2255 | 2243 | client = getFormRecognizerAsyncClient(httpClient, serviceVersion); |
2256 | | - invalidSourceUrlRunner((invalidSourceUrl) -> { |
2257 | | - HttpResponseException errorResponseException |
2258 | | - = assertThrows(HttpResponseException.class, |
2259 | | - () -> client.beginRecognizeIdentityDocumentsFromUrl(invalidSourceUrl) |
2260 | | - .setPollInterval(durationTestMode).getSyncPoller().getFinalResult()); |
2261 | | - FormRecognizerErrorInformation errorInformation |
2262 | | - = (FormRecognizerErrorInformation) errorResponseException.getValue(); |
2263 | | - assertEquals(INVALID_IMAGE_URL_ERROR_CODE, errorInformation.getErrorCode()); |
2264 | | - }); |
| 2244 | + invalidSourceUrlRunner((invalidSourceUrl) -> |
| 2245 | + assertThrows(HttpResponseException.class, |
| 2246 | + () -> client.beginRecognizeIdentityDocumentsFromUrl(invalidSourceUrl) |
| 2247 | + .setPollInterval(durationTestMode).getSyncPoller().getFinalResult())); |
2265 | 2248 | } |
2266 | 2249 |
|
2267 | 2250 | /** |
|
0 commit comments