|
5 | 5 |
|
6 | 6 | package io.opentelemetry.instrumentation.testing.junit; |
7 | 7 |
|
8 | | -import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat; |
9 | | - |
10 | 8 | import io.opentelemetry.api.OpenTelemetry; |
11 | 9 | import io.opentelemetry.context.ContextStorage; |
12 | 10 | import io.opentelemetry.instrumentation.testing.InstrumentationTestRunner; |
|
21 | 19 | import io.opentelemetry.sdk.testing.assertj.MetricAssert; |
22 | 20 | import io.opentelemetry.sdk.testing.assertj.TraceAssert; |
23 | 21 | import io.opentelemetry.sdk.trace.data.SpanData; |
24 | | -import java.util.ArrayList; |
25 | | -import java.util.Arrays; |
26 | 22 | import java.util.Comparator; |
27 | | -import java.util.Iterator; |
28 | 23 | import java.util.List; |
29 | 24 | import java.util.function.Consumer; |
30 | 25 | import org.assertj.core.api.ListAssert; |
@@ -157,25 +152,15 @@ public final void waitAndAssertTraces(Iterable<? extends Consumer<TraceAssert>> |
157 | 152 | testRunner.waitAndAssertTraces(assertions); |
158 | 153 | } |
159 | 154 |
|
160 | | - private void doWaitAndAssertLogRecords(List<Consumer<LogRecordDataAssert>> assertions) { |
161 | | - List<LogRecordData> logRecordDataList = waitForLogRecords(assertions.size()); |
162 | | - Iterator<Consumer<LogRecordDataAssert>> assertionIterator = assertions.iterator(); |
163 | | - for (LogRecordData logRecordData : logRecordDataList) { |
164 | | - assertionIterator.next().accept(assertThat(logRecordData)); |
165 | | - } |
166 | | - } |
167 | | - |
168 | 155 | public final void waitAndAssertLogRecords( |
169 | 156 | Iterable<? extends Consumer<LogRecordDataAssert>> assertions) { |
170 | | - List<Consumer<LogRecordDataAssert>> assertionsList = new ArrayList<>(); |
171 | | - assertions.forEach(assertionsList::add); |
172 | | - doWaitAndAssertLogRecords(assertionsList); |
| 157 | + testRunner.waitAndAssertLogRecords(assertions); |
173 | 158 | } |
174 | 159 |
|
175 | 160 | @SafeVarargs |
176 | 161 | @SuppressWarnings("varargs") |
177 | 162 | public final void waitAndAssertLogRecords(Consumer<LogRecordDataAssert>... assertions) { |
178 | | - doWaitAndAssertLogRecords(Arrays.asList(assertions)); |
| 163 | + testRunner.waitAndAssertLogRecords(assertions); |
179 | 164 | } |
180 | 165 |
|
181 | 166 | /** |
|
0 commit comments