|
16 | 16 | import java.util.List; |
17 | 17 | import java.util.Map; |
18 | 18 |
|
| 19 | +import static java.util.Map.entry; |
| 20 | +import static org.hamcrest.Matchers.sameInstance; |
| 21 | + |
19 | 22 | public class EcsNamespaceProcessorTests extends ESTestCase { |
20 | 23 |
|
21 | 24 | private final EcsNamespaceProcessor processor = new EcsNamespaceProcessor("test", "test processor"); |
@@ -111,18 +114,15 @@ public void testIsOTelDocument_validBody() { |
111 | 114 | } |
112 | 115 |
|
113 | 116 | public void testExecute_validOTelDocument() { |
114 | | - Map<String, Object> source = new HashMap<>(); |
115 | | - source.put("resource", new HashMap<>()); |
116 | | - source.put("scope", new HashMap<>()); |
117 | | - Map<String, Object> body = new HashMap<>(); |
118 | | - body.put("text", "a string"); |
119 | | - body.put("structured", new HashMap<>()); |
120 | | - source.put("body", body); |
121 | | - source.put("key1", "value1"); |
122 | | - Map<String, Object> before = new HashMap<>(source); |
| 117 | + Map<String, Object> source = Map.ofEntries( |
| 118 | + entry("resource", Map.of()), |
| 119 | + entry("scope", Map.of()), |
| 120 | + entry("body", Map.of("text", "a string", "structured", Map.of())), |
| 121 | + entry("key1", "value1") |
| 122 | + ); |
123 | 123 | IngestDocument document = new IngestDocument("index", "id", 1, null, null, source); |
124 | 124 | processor.execute(document); |
125 | | - assertEquals(before, document.getSource()); |
| 125 | + assertThat(source, sameInstance(document.getSource())); |
126 | 126 | } |
127 | 127 |
|
128 | 128 | public void testExecute_nonOTelDocument() { |
|
0 commit comments