|
27 | 27 | import io.micrometer.core.instrument.distribution.DistributionStatisticConfig;
|
28 | 28 | import io.micrometer.core.instrument.distribution.ValueAtPercentile;
|
29 | 29 | import io.micrometer.core.instrument.distribution.pause.PauseDetector;
|
30 |
| -import io.micrometer.core.instrument.search.MeterNotFoundException; |
31 | 30 | import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
32 | 31 | import io.micrometer.core.instrument.util.TimeUtils;
|
33 | 32 | import org.aspectj.lang.ProceedingJoinPoint;
|
|
44 | 43 | import java.util.function.Predicate;
|
45 | 44 |
|
46 | 45 | import static java.util.concurrent.CompletableFuture.supplyAsync;
|
47 |
| -import static org.assertj.core.api.Assertions.*; |
| 46 | +import static org.assertj.core.api.Assertions.assertThat; |
| 47 | +import static org.assertj.core.api.Assertions.assertThatThrownBy; |
48 | 48 |
|
49 | 49 | class TimedAspectTest {
|
50 | 50 |
|
@@ -252,7 +252,7 @@ void timeMethodWhenCompletedExceptionally() {
|
252 | 252 | assertThat(registry.getMeters()).isEmpty();
|
253 | 253 |
|
254 | 254 | guardedResult.complete(new IllegalStateException("simulated"));
|
255 |
| - catchThrowableOfType(completableFuture::join, CompletionException.class); |
| 255 | + assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class); |
256 | 256 |
|
257 | 257 | assertThat(registry.get("call")
|
258 | 258 | .tag("class", getClass().getName() + "$AsyncTimedService")
|
@@ -312,8 +312,8 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
|
312 | 312 | .longTaskTimer()
|
313 | 313 | .activeTasks()).isEqualTo(1);
|
314 | 314 |
|
315 |
| - guardedResult.complete(new NullPointerException()); |
316 |
| - catchThrowableOfType(completableFuture::join, CompletionException.class); |
| 315 | + guardedResult.complete(new IllegalStateException("simulated")); |
| 316 | + assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class); |
317 | 317 |
|
318 | 318 | assertThat(registry.get("longCall")
|
319 | 319 | .tag("class", getClass().getName() + "$AsyncTimedService")
|
@@ -387,7 +387,7 @@ void timeClassWithSkipPredicate() {
|
387 | 387 |
|
388 | 388 | service.call();
|
389 | 389 |
|
390 |
| - assertThat(registry.find("call").timer()).isNull(); |
| 390 | + assertThat(registry.getMeters()).isEmpty(); |
391 | 391 | }
|
392 | 392 |
|
393 | 393 | @Test
|
@@ -434,7 +434,7 @@ void ignoreClassLevelAnnotationIfMethodLevelPresent() {
|
434 | 434 |
|
435 | 435 | service.annotatedOnMethod();
|
436 | 436 |
|
437 |
| - assertThatExceptionOfType(MeterNotFoundException.class).isThrownBy(() -> registry.get("call").timer()); |
| 437 | + assertThat(registry.getMeters()).hasSize(1); |
438 | 438 | assertThat(registry.get("annotatedOnMethod")
|
439 | 439 | .tag("class", "io.micrometer.core.aop.TimedAspectTest$TimedClass")
|
440 | 440 | .tag("method", "annotatedOnMethod")
|
|
0 commit comments