Skip to content

Commit

Permalink
add UT for list inside map
Browse files Browse the repository at this point in the history
Signed-off-by: xinyual <[email protected]>
  • Loading branch information
xinyual committed Mar 7, 2024
1 parent 36d6816 commit b2e8f36
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ private Map<String, Object> createFixedTokenLengthParameters() {
return parameters;
}

private List<Map<String, Object>> createSourceDataListNestedMap() {
Map<String, Object> documents = new HashMap<>();
documents.put(INPUT_FIELD, createSourceDataString());
return List.of(documents, documents);
}

private Map<String, Object> createFixedTokenLengthParametersWithMaxChunk(int maxChunkNum) {
Map<String, Object> parameters = new HashMap<>();
parameters.put(FixedTokenLengthChunker.TOKEN_LIMIT_FIELD, 10);
Expand Down Expand Up @@ -398,8 +404,8 @@ public void testExecute_withFixedTokenLength_andFieldMapNestedMap_sourceList_suc
List<String> expectedPassages = new ArrayList<>();

expectedPassages.add("This is an example document to be chunked The document");
expectedPassages.add("The document contains a single paragraph two sentences and 24");
expectedPassages.add("and 24 tokens by standard tokenizer in OpenSearch");
expectedPassages.add("contains a single paragraph two sentences and 24 tokens by");
expectedPassages.add("standard tokenizer in OpenSearch");
assert (nestedResult instanceof List);
assertEquals(((List<?>) nestedResult).size(), 2);
for (Object result : (List<Object>) nestedResult) {
Expand Down

0 comments on commit b2e8f36

Please sign in to comment.