Skip to content

Commit 14dcc05

Browse files
committed
add another test case
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent d4f2944 commit 14dcc05

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

protocol/src/test/java/org/opensearch/sql/protocol/response/QueryResultTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,25 @@ void highlights_returns_null_when_no_highlight_data() {
175175
assertEquals(1, highlights.size());
176176
assertNull(highlights.get(0));
177177
}
178+
179+
@Test
180+
void highlights_returns_null_when_highlight_is_missing() {
181+
QueryResult response =
182+
new QueryResult(
183+
schema,
184+
Collections.singletonList(
185+
ExprTupleValue.fromExprValueMap(
186+
ImmutableMap.of(
187+
"name",
188+
ExprValueUtils.stringValue("John"),
189+
"age",
190+
ExprValueUtils.integerValue(20),
191+
"_highlight",
192+
ExprValueUtils.LITERAL_MISSING))),
193+
Cursor.None);
194+
195+
List<Map<String, Object>> highlights = response.highlights();
196+
assertEquals(1, highlights.size());
197+
assertNull(highlights.get(0));
198+
}
178199
}

0 commit comments

Comments
 (0)