Skip to content

Commit

Permalink
Merge branch '1.13.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatan-ivanov committed Sep 19, 2024
2 parents ea79e74 + 9d11458 commit a536dd8
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import io.micrometer.core.instrument.distribution.DistributionStatisticConfig;
import io.micrometer.core.instrument.distribution.ValueAtPercentile;
import io.micrometer.core.instrument.distribution.pause.PauseDetector;
import io.micrometer.core.instrument.search.MeterNotFoundException;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import io.micrometer.core.instrument.util.TimeUtils;
import org.aspectj.lang.ProceedingJoinPoint;
Expand All @@ -44,7 +43,8 @@
import java.util.function.Predicate;

import static java.util.concurrent.CompletableFuture.supplyAsync;
import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class TimedAspectTest {

Expand Down Expand Up @@ -252,7 +252,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 @@ -312,8 +312,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 @@ -387,7 +387,7 @@ void timeClassWithSkipPredicate() {

service.call();

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

@Test
Expand Down Expand Up @@ -434,7 +434,7 @@ void ignoreClassLevelAnnotationIfMethodLevelPresent() {

service.annotatedOnMethod();

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

0 comments on commit a536dd8

Please sign in to comment.