Skip to content

Commit f530d87

Browse files
Improve assertions in TimedAspectTest
1 parent 8994c8f commit f530d87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void timeMethodWhenCompletedExceptionally() {
201201
assertThat(registry.getMeters()).isEmpty();
202202

203203
guardedResult.complete(new IllegalStateException("simulated"));
204-
catchThrowableOfType(completableFuture::join, CompletionException.class);
204+
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);
205205

206206
assertThat(registry.get("call")
207207
.tag("class", getClass().getName() + "$AsyncTimedService")
@@ -261,8 +261,8 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
261261
.longTaskTimer()
262262
.activeTasks()).isEqualTo(1);
263263

264-
guardedResult.complete(new NullPointerException());
265-
catchThrowableOfType(completableFuture::join, CompletionException.class);
264+
guardedResult.complete(new IllegalStateException("simulated"));
265+
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);
266266

267267
assertThat(registry.get("longCall")
268268
.tag("class", getClass().getName() + "$AsyncTimedService")
@@ -336,7 +336,7 @@ void timeClassWithSkipPredicate() {
336336

337337
service.call();
338338

339-
assertThat(registry.find("call").timer()).isNull();
339+
assertThat(registry.getMeters()).isEmpty();
340340
}
341341

342342
@Test

0 commit comments

Comments
 (0)