Skip to content

Commit 59a7dfc

Browse files
committed
inline conversion to map
1 parent b170021 commit 59a7dfc

File tree

1 file changed

+2
-5
lines changed
  • jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/assertions

1 file changed

+2
-5
lines changed

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/assertions/MetricAssert.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ public final MetricAssert hasDataPointsWithAttributes(AttributeMatcherSet... att
264264

265265
// validate each datapoint attributes match exactly one of the provided attributes sets
266266
for (NumberDataPoint dataPoint : dataPoints) {
267-
Map<String, String> dataPointAttributes = toMap(dataPoint.getAttributesList());
267+
Map<String, String> dataPointAttributes = dataPoint.getAttributesList().stream()
268+
.collect(Collectors.toMap(KeyValue::getKey, kv -> kv.getValue().getStringValue()));
268269
int matchCount = 0;
269270
for (int i = 0; i < attributeMatchers.length; i++) {
270271
if (attributeMatchers[i].matches(dataPointAttributes)) {
@@ -289,8 +290,4 @@ public final MetricAssert hasDataPointsWithAttributes(AttributeMatcherSet... att
289290
});
290291
}
291292

292-
private static Map<String, String> toMap(List<KeyValue> list) {
293-
return list.stream()
294-
.collect(Collectors.toMap(KeyValue::getKey, kv -> kv.getValue().getStringValue()));
295-
}
296293
}

0 commit comments

Comments
 (0)