Skip to content

Commit

Permalink
SDK-2340: Add missing javadoc comments / add missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
bucky-boy authored and MrBurtyyy committed Sep 23, 2024
1 parent 26b71ed commit 364d037
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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"));
}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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));
}

}

0 comments on commit 364d037

Please sign in to comment.