Skip to content

Commit a536dd8

Browse files
Merge branch '1.13.x'
2 parents ea79e74 + 9d11458 commit a536dd8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

micrometer-core/src/test/java/io/micrometer/core/aop/TimedAspectTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import io.micrometer.core.instrument.distribution.DistributionStatisticConfig;
2828
import io.micrometer.core.instrument.distribution.ValueAtPercentile;
2929
import io.micrometer.core.instrument.distribution.pause.PauseDetector;
30-
import io.micrometer.core.instrument.search.MeterNotFoundException;
3130
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
3231
import io.micrometer.core.instrument.util.TimeUtils;
3332
import org.aspectj.lang.ProceedingJoinPoint;
@@ -44,7 +43,8 @@
4443
import java.util.function.Predicate;
4544

4645
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;
4848

4949
class TimedAspectTest {
5050

@@ -252,7 +252,7 @@ void timeMethodWhenCompletedExceptionally() {
252252
assertThat(registry.getMeters()).isEmpty();
253253

254254
guardedResult.complete(new IllegalStateException("simulated"));
255-
catchThrowableOfType(completableFuture::join, CompletionException.class);
255+
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);
256256

257257
assertThat(registry.get("call")
258258
.tag("class", getClass().getName() + "$AsyncTimedService")
@@ -312,8 +312,8 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
312312
.longTaskTimer()
313313
.activeTasks()).isEqualTo(1);
314314

315-
guardedResult.complete(new NullPointerException());
316-
catchThrowableOfType(completableFuture::join, CompletionException.class);
315+
guardedResult.complete(new IllegalStateException("simulated"));
316+
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);
317317

318318
assertThat(registry.get("longCall")
319319
.tag("class", getClass().getName() + "$AsyncTimedService")
@@ -387,7 +387,7 @@ void timeClassWithSkipPredicate() {
387387

388388
service.call();
389389

390-
assertThat(registry.find("call").timer()).isNull();
390+
assertThat(registry.getMeters()).isEmpty();
391391
}
392392

393393
@Test
@@ -434,7 +434,7 @@ void ignoreClassLevelAnnotationIfMethodLevelPresent() {
434434

435435
service.annotatedOnMethod();
436436

437-
assertThatExceptionOfType(MeterNotFoundException.class).isThrownBy(() -> registry.get("call").timer());
437+
assertThat(registry.getMeters()).hasSize(1);
438438
assertThat(registry.get("annotatedOnMethod")
439439
.tag("class", "io.micrometer.core.aop.TimedAspectTest$TimedClass")
440440
.tag("method", "annotatedOnMethod")

0 commit comments

Comments
 (0)