File tree Expand file tree Collapse file tree
protocol/src/test/java/org/opensearch/sql/protocol/response Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments