|
4 | 4 | import static java.util.concurrent.TimeUnit.MILLISECONDS; |
5 | 5 | import static org.assertj.core.api.Assertions.assertThat; |
6 | 6 | import static org.awaitility.Awaitility.waitAtMost; |
| 7 | +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; |
7 | 8 |
|
8 | 9 | import com.microsoft.applicationinsights.agent.bootstrap.MicrometerUtil; |
9 | 10 | import io.micrometer.core.instrument.Clock; |
|
23 | 24 | import java.util.concurrent.ExecutorService; |
24 | 25 | import java.util.concurrent.Executors; |
25 | 26 | import java.util.stream.Collectors; |
| 27 | +import org.junit.jupiter.api.BeforeEach; |
26 | 28 | import org.junit.jupiter.api.Disabled; |
27 | 29 | import org.junit.jupiter.api.Test; |
| 30 | +import org.junit.jupiter.api.parallel.Execution; |
28 | 31 |
|
| 32 | +@Execution(SAME_THREAD) |
29 | 33 | class MicrometerTest { |
30 | 34 |
|
31 | | - private static final AgentTestingMicrometerDelegate delegate = new AgentTestingMicrometerDelegate(); |
| 35 | + private AgentTestingMicrometerDelegate delegate; |
32 | 36 |
|
33 | | - static { |
| 37 | + @BeforeEach |
| 38 | + void beforeEach() { |
| 39 | + delegate = new AgentTestingMicrometerDelegate(); |
34 | 40 | MicrometerUtil.setDelegate(delegate); |
35 | 41 | } |
36 | 42 |
|
@@ -252,7 +258,7 @@ void shouldCaptureFunctionTimer() { |
252 | 258 | assertThat(measurement.namespace).isNull(); |
253 | 259 | } |
254 | 260 |
|
255 | | - private static AgentTestingMicrometerDelegate.Measurement getLastMeasurement(String name) { |
| 261 | + private AgentTestingMicrometerDelegate.Measurement getLastMeasurement(String name) { |
256 | 262 | List<AgentTestingMicrometerDelegate.Measurement> measurements = |
257 | 263 | delegate.getMeasurements().stream() |
258 | 264 | .filter(measurement -> measurement.name.equals(name) && measurement.value != 0) |
|
0 commit comments