Skip to content

Commit

Permalink
Improve assertions in TimedAspectTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatan-ivanov committed Sep 19, 2024
1 parent 8994c8f commit f530d87
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void timeMethodWhenCompletedExceptionally() {
assertThat(registry.getMeters()).isEmpty();

guardedResult.complete(new IllegalStateException("simulated"));
catchThrowableOfType(completableFuture::join, CompletionException.class);
assertThatThrownBy(completableFuture::join).isInstanceOf(CompletionException.class);

assertThat(registry.get("call")
.tag("class", getClass().getName() + "$AsyncTimedService")
Expand Down Expand Up @@ -261,8 +261,8 @@ void timeMethodWithLongTaskTimerWhenCompletedExceptionally() {
.longTaskTimer()
.activeTasks()).isEqualTo(1);

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

assertThat(registry.get("longCall")
.tag("class", getClass().getName() + "$AsyncTimedService")
Expand Down Expand Up @@ -336,7 +336,7 @@ void timeClassWithSkipPredicate() {

service.call();

assertThat(registry.find("call").timer()).isNull();
assertThat(registry.getMeters()).isEmpty();
}

@Test
Expand Down

0 comments on commit f530d87

Please sign in to comment.