Skip to content

Commit

Permalink
add unit test with null input
Browse files Browse the repository at this point in the history
Signed-off-by: yuye-aws <[email protected]>
  • Loading branch information
yuye-aws committed Mar 15, 2024
1 parent 0a04012 commit a524954
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,17 @@ public void testExecute_withFixedTokenLength_andSourceDataListWithHybridType_the
assertEquals(((List<?>) listResult).size(), 0);
}

@SneakyThrows
public void testExecute_withFixedTokenLength_andSourceDataNull_thenSucceed() {
TextChunkingProcessor processor = createFixedTokenLengthInstance(createStringFieldMap());
IngestDocument ingestDocument = createIngestDocumentWithSourceData(null);
IngestDocument document = processor.execute(ingestDocument);
assert document.getSourceAndMetadata().containsKey(INPUT_FIELD);
Object listResult = document.getSourceAndMetadata().get(OUTPUT_FIELD);
assert (listResult instanceof List);
assertEquals(((List<?>) listResult).size(), 0);
}

@SneakyThrows
public void testExecute_withDelimiter_andSourceDataString_thenSucceed() {
TextChunkingProcessor processor = createDelimiterInstance();
Expand Down

0 comments on commit a524954

Please sign in to comment.