@@ -343,11 +343,7 @@ public void testEncodeFieldToMap() throws IOException {
343343 ParsedDocument parsedDocument = getParsedDocumentWithFieldLimit (b -> b .field ("my_value" , value ));
344344 IgnoredSourceFieldMapper .MappedNameValue mappedNameValue ;
345345 var bytes = parsedDocument .rootDoc ().getField (IgnoredSourceFieldMapper .NAME ).binaryValue ();
346- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
347- mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
348- } else {
349- mappedNameValue = IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .decodeAsMap (bytes );
350- }
346+ mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
351347 assertEquals ("my_value" , mappedNameValue .nameValue ().name ());
352348 assertEquals (value , mappedNameValue .map ().get ("my_value" ));
353349 }
@@ -360,18 +356,10 @@ public void testEncodeObjectToMapAndDecode() throws IOException {
360356 );
361357 var bytes = parsedDocument .rootDoc ().getField (IgnoredSourceFieldMapper .NAME ).binaryValue ();
362358 IgnoredSourceFieldMapper .MappedNameValue mappedNameValue ;
363- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
364- mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
365- } else {
366- mappedNameValue = IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .decodeAsMap (bytes );
367- }
359+ mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
368360 assertEquals ("my_object" , mappedNameValue .nameValue ().name ());
369361 assertEquals (value , ((Map <String , ?>) mappedNameValue .map ().get ("my_object" )).get ("my_value" ));
370- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
371- assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
372- } else {
373- assertEquals (bytes , IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .encodeFromMap (mappedNameValue ));
374- }
362+ assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
375363 }
376364
377365 public void testEncodeArrayToMapAndDecode () throws IOException {
@@ -383,18 +371,10 @@ public void testEncodeArrayToMapAndDecode() throws IOException {
383371 });
384372 var bytes = parsedDocument .rootDoc ().getField (IgnoredSourceFieldMapper .NAME ).binaryValue ();
385373 IgnoredSourceFieldMapper .MappedNameValue mappedNameValue ;
386- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
387- mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
388- } else {
389- mappedNameValue = IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .decodeAsMap (bytes );
390- }
374+ mappedNameValue = IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .decodeAsMap (bytes ).getFirst ();
391375 assertEquals ("my_array" , mappedNameValue .nameValue ().name ());
392376 assertThat ((List <?>) mappedNameValue .map ().get ("my_array" ), Matchers .contains (Map .of ("int_value" , 10 ), Map .of ("int_value" , 20 )));
393- if (IgnoredSourceFieldMapper .COALESCE_IGNORED_SOURCE_ENTRIES .isEnabled ()) {
394- assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
395- } else {
396- assertEquals (bytes , IgnoredSourceFieldMapper .LegacyIgnoredSourceEncoding .encodeFromMap (mappedNameValue ));
397- }
377+ assertEquals (bytes , IgnoredSourceFieldMapper .CoalescedIgnoredSourceEncoding .encodeFromMap (List .of (mappedNameValue )));
398378 }
399379
400380 public void testMultipleIgnoredFieldsRootObject () throws IOException {
0 commit comments