Use new AssertJ duration assertions

See gh-19985
This commit is contained in:
dreis2211
2020-01-30 08:02:22 +01:00
committed by Stephane Nicoll
parent 7de3712e56
commit fac6f08ca3
12 changed files with 108 additions and 116 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.springframework.boot.test.autoconfigure.web.reactive;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.List;
import org.junit.jupiter.api.Test;
@@ -75,8 +74,8 @@ class WebTestClientAutoConfigurationTests {
this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues("spring.test.webtestclient.timeout=15m").run((context) -> {
WebTestClient webTestClient = context.getBean(WebTestClient.class);
Object duration = ReflectionTestUtils.getField(webTestClient, "timeout");
assertThat(duration).isEqualTo(Duration.of(15, ChronoUnit.MINUTES));
Duration duration = (Duration) ReflectionTestUtils.getField(webTestClient, "timeout");
assertThat(duration).hasMinutes(15);
});
}