diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 305cd07410c84..6f770af88a0da 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -148,6 +148,7 @@ "sdk/keyvault/test-resources/test-resources.json", "sdk/keyvault/test-resources-jca/test-resources.json", "sdk/formrecognizer/azure-ai-formrecognizer/**", + "sdk/formrecognizer/test-resources.json", "sdk/documentintelligence/azure-ai-documentintelligence/**", "sdk/documentintelligence/test-resources.json", "sdk/maps/azure-maps-render/**", diff --git a/sdk/documentintelligence/test-resources.json b/sdk/documentintelligence/test-resources.json index 000be3ce8d53a..bdb59ee84f353 100644 --- a/sdk/documentintelligence/test-resources.json +++ b/sdk/documentintelligence/test-resources.json @@ -34,6 +34,10 @@ "type": "string", "defaultValue": "trainingdata-batch" }, + "batchTrainingDataResultContainer": { + "type": "string", + "defaultValue": "trainingdata-batch-result" + }, "selectionMarkTrainingDataContainer": { "type": "string", "defaultValue": "selectionmark-v3" diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/util/Transforms.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/util/Transforms.java index 53cc1eb913e6d..318d608fa785d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/util/Transforms.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/util/Transforms.java @@ -573,9 +573,11 @@ private static void setDocumentFieldValue( DocumentFieldHelper.setValue(documentField, null); } else { CurrencyValue currencyValue = new CurrencyValue(); - CurrencyValueHelper.setAmount(currencyValue, innerDocumentField.getValueCurrency().getAmount()); - CurrencyValueHelper.setCurrencySymbol(currencyValue, - innerDocumentField.getValueCurrency().getCurrencySymbol()); + com.azure.ai.formrecognizer.documentanalysis.implementation.models.CurrencyValue innerCurrencyValue + = innerDocumentField.getValueCurrency(); + CurrencyValueHelper.setAmount(currencyValue, innerCurrencyValue.getAmount()); + CurrencyValueHelper.setCurrencySymbol(currencyValue, innerCurrencyValue.getCurrencySymbol()); + CurrencyValueHelper.setCode(currencyValue, innerCurrencyValue.getCurrencyCode()); DocumentFieldHelper.setValue(documentField, currencyValue); } } else if (com.azure.ai.formrecognizer.documentanalysis.implementation.models.DocumentFieldType.ADDRESS diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java index e8d842a3d7bbc..fbcbbeb8da15c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java @@ -9,9 +9,11 @@ import com.azure.ai.formrecognizer.documentanalysis.administration.models.DocumentClassifierDetails; import com.azure.ai.formrecognizer.documentanalysis.models.AnalyzeDocumentOptions; import com.azure.ai.formrecognizer.documentanalysis.models.AnalyzeResult; +import com.azure.ai.formrecognizer.documentanalysis.models.CurrencyValue; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentAnalysisFeature; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentBarcode; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentBarcodeKind; +import com.azure.ai.formrecognizer.documentanalysis.models.DocumentField; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentFormula; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentFormulaKind; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentStyle; @@ -993,6 +995,11 @@ public void analyzeInvoiceWithPage(HttpClient httpClient, DocumentAnalysisServic AnalyzeResult analyzeResult = syncPoller.getFinalResult(); Assertions.assertEquals(1, analyzeResult.getPages().size()); + Map invoicePage1Fields = analyzeResult.getDocuments().get(0).getFields(); + CurrencyValue invoiceTotalField = invoicePage1Fields.get("InvoiceTotal").getValueAsCurrency(); + assertEquals(56651.49, invoiceTotalField.getAmount()); + assertEquals("$", invoiceTotalField.getSymbol()); + assertEquals("USD", invoiceTotalField.getCode()); }, INVOICE_PDF); } diff --git a/sdk/formrecognizer/test-resources.json b/sdk/formrecognizer/test-resources.json index 1851e86930844..412f034983c15 100644 --- a/sdk/formrecognizer/test-resources.json +++ b/sdk/formrecognizer/test-resources.json @@ -24,7 +24,7 @@ }, "blobStorageAccount": { "type": "string", - "defaultValue": "azuresdktrainingdata" + "defaultValue": "azuresdktrainingdatatme" }, "trainingDataContainerV3": { "type": "string", @@ -48,7 +48,7 @@ }, "blobResourceId": { "type": "string", - "defaultValue": "[resourceId(subscription().subscriptionId, 'TrainingData', 'Microsoft.Storage/storageAccounts', parameters('blobStorageAccount'))]" + "defaultValue": "[resourceId('4d042dc6-fe17-4698-a23f-ec6a8d1e98f4', 'static-test-resources', 'Microsoft.Storage/storageAccounts', parameters('blobStorageAccount'))]" }, "trainingDataSasPropertiesV3": { "type": "object", diff --git a/sdk/formrecognizer/tests.yml b/sdk/formrecognizer/tests.yml index a3c2f22e3a667..1dde237520d9a 100644 --- a/sdk/formrecognizer/tests.yml +++ b/sdk/formrecognizer/tests.yml @@ -11,4 +11,4 @@ extends: safeName: azureaiformrecognizer CloudConfig: Public: - Location: 'centraluseuap' + Location: 'eastus'