diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java index 9ba67453..51bbbed0 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTask.java @@ -33,31 +33,55 @@ public static class Builder { private String chipData; private Boolean createExpandedDocumentFields; + /** + * Apply manual_check ALWAYS to all ID_DOCUMENT_TEXT_DATA_EXTRACTION tasks in the session + * @return the builder + */ public Builder withManualCheckAlways() { this.manualCheck = DocScanConstants.ALWAYS; return this; } + /** + * Apply manual_check FALLBACK to all ID_DOCUMENT_TEXT_DATA_EXTRACTION tasks in the session + * @return the builder + */ public Builder withManualCheckFallback() { this.manualCheck = DocScanConstants.FALLBACK; return this; } + /** + * Apply manual_check NEVER to all ID_DOCUMENT_TEXT_DATA_EXTRACTION tasks in the session + * @return the builder + */ public Builder withManualCheckNever() { this.manualCheck = DocScanConstants.NEVER; return this; } + /** + * Apply chip_data DESIRED to all ID_DOCUMENT_TEXT_DATA_EXTRACTION tasks in the session + * @return the builder + */ public Builder withChipDataDesired() { this.chipData = DocScanConstants.DESIRED; return this; } + /** + * Apply chip_data IGNORED to all ID_DOCUMENT_TEXT_DATA_EXTRACTION tasks in the session + * @return the builder + */ public Builder withChipDataIgnore() { this.chipData = DocScanConstants.IGNORE; return this; } + /** + * Whether to request the creation of expanded document fields for every ID_DOCUMENT_TEXT_DATA_EXTRACTION task + * @return the builder + */ public Builder withCreateExpandedDocumentFields(boolean value) { this.createExpandedDocumentFields = value; return this; diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java index 2f86306d..ae796357 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskConfig.java @@ -42,10 +42,9 @@ public String getChipData() { } /** - * Describes if expanded document fields should be created for a text-extraction task - * in the session. + * Describes whether or not expanded document fields should be created as part of text extraction * - * @return if expanded document fields should be created + * @return whether to create expanded document fields */ public Boolean getCreateExpandedDocumentFields() { return createExpandedDocumentFields; diff --git a/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java b/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java index 65452c4d..626584d0 100644 --- a/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java +++ b/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/task/RequestedIdDocTextExtractionTaskTest.java @@ -1,24 +1,30 @@ package com.yoti.api.client.docs.session.create.task; - import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.nullValue; import org.junit.Test; public class RequestedIdDocTextExtractionTaskTest { + @Test + public void shouldDefaultConfigValuesToNull() { + RequestedIdDocTextExtractionTask result = RequestedIdDocTextExtractionTask.builder().build(); + + assertThat(result.getType(), is("ID_DOCUMENT_TEXT_DATA_EXTRACTION")); + assertThat(result.getConfig().getChipData(), is(nullValue())); + assertThat(result.getConfig().getManualCheck(), is(nullValue())); + assertThat(result.getConfig().getCreateExpandedDocumentFields(), is(nullValue())); + } + @Test public void shouldBuildSimpleRequestedTextExtractionTaskWithManualFallbackAlways() { RequestedIdDocTextExtractionTask result = RequestedIdDocTextExtractionTask.builder() .withManualCheckAlways() .build(); - assertThat(result, is(instanceOf(RequestedIdDocTextExtractionTask.class))); - assertThat(result.getConfig(), instanceOf(RequestedIdDocTextExtractionTaskConfig.class)); assertThat(result.getType(), is("ID_DOCUMENT_TEXT_DATA_EXTRACTION")); - RequestedIdDocTextExtractionTaskConfig configResult = result.getConfig(); assertThat(configResult.getManualCheck(), is("ALWAYS")); } @@ -29,8 +35,7 @@ public void shouldBuildSimpleRequestedTextExtractionTaskWithManualFallbackFallba .withManualCheckFallback() .build(); - RequestedIdDocTextExtractionTaskConfig configResult = result.getConfig(); - assertThat(configResult.getManualCheck(), is("FALLBACK")); + assertThat(result.getConfig().getManualCheck(), is("FALLBACK")); } @Test @@ -39,8 +44,7 @@ public void shouldBuildSimpleRequestedTextExtractionTaskWithManualFallbackNever( .withManualCheckNever() .build(); - RequestedIdDocTextExtractionTaskConfig configResult = result.getConfig(); - assertThat(configResult.getManualCheck(), is("NEVER")); + assertThat(result.getConfig().getManualCheck(), is("NEVER")); } @Test @@ -49,8 +53,7 @@ public void shouldBuildSimpleRequestedTextExtractionTaskWithChipDataDesired() { .withChipDataDesired() .build(); - RequestedIdDocTextExtractionTaskConfig configResult = result.getConfig(); - assertThat(configResult.getChipData(), is("DESIRED")); + assertThat(result.getConfig().getChipData(), is("DESIRED")); } @Test @@ -59,8 +62,7 @@ public void shouldBuildSimpleRequestedTextExtractionTaskWithChipDataIgnore() { .withChipDataIgnore() .build(); - RequestedIdDocTextExtractionTaskConfig configResult = result.getConfig(); - assertThat(configResult.getChipData(), is("IGNORE")); + assertThat(result.getConfig().getChipData(), is("IGNORE")); } @Test @@ -69,8 +71,7 @@ public void shouldBuildSimpleRequestedTextExtractionTaskWithCreateExpandedDocume .withCreateExpandedDocumentFields(true) .build(); - RequestedIdDocTextExtractionTaskConfig configResult = result.getConfig(); - assertThat(configResult.getCreateExpandedDocumentFields(), is(true)); + assertThat(result.getConfig().getCreateExpandedDocumentFields(), is(true)); } }