diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java index d1229b02273..2eb54b83036 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java @@ -26,7 +26,6 @@ import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractObjectArrayAssert; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.AbstractThrowableAssert; -import org.assertj.core.api.Assertions; import org.assertj.core.api.MapAssert; import org.assertj.core.error.BasicErrorMessageFactory; @@ -223,8 +222,8 @@ public class ApplicationContextAssert if (this.startupFailure != null) { throwAssertionError(contextFailedToStartWhenExpecting("to get beans names with type:%n <%s>", type)); } - return Assertions.assertThat(getApplicationContext().getBeanNamesForType(type)) - .as("Bean names of type <%s> from <%s>", type, getApplicationContext()); + return assertThat(getApplicationContext().getBeanNamesForType(type)).as("Bean names of type <%s> from <%s>", + type, getApplicationContext()); } /** @@ -277,7 +276,7 @@ public class ApplicationContextAssert getApplicationContext(), type, names)); } T bean = (name != null) ? getApplicationContext().getBean(name, type) : null; - return Assertions.assertThat(bean).as("Bean of type <%s> from <%s>", type, getApplicationContext()); + return assertThat(bean).as("Bean of type <%s> from <%s>", type, getApplicationContext()); } private String getPrimary(String[] names, Scope scope) { @@ -328,7 +327,7 @@ public class ApplicationContextAssert throwAssertionError(contextFailedToStartWhenExpecting("to contain a bean of name:%n <%s>", name)); } Object bean = findBean(name); - return Assertions.assertThat(bean).as("Bean of name <%s> from <%s>", name, getApplicationContext()); + return assertThat(bean).as("Bean of name <%s> from <%s>", name, getApplicationContext()); } /** @@ -360,8 +359,8 @@ public class ApplicationContextAssert "%nExpecting:%n <%s>%nto contain a bean of name:%n <%s> (%s)%nbut found:%n <%s> of type <%s>", getApplicationContext(), name, type, bean, bean.getClass())); } - return Assertions.assertThat((T) bean) - .as("Bean of name <%s> and type <%s> from <%s>", name, type, getApplicationContext()); + return assertThat((T) bean).as("Bean of name <%s> and type <%s> from <%s>", name, type, + getApplicationContext()); } private Object findBean(String name) { @@ -411,8 +410,8 @@ public class ApplicationContextAssert if (this.startupFailure != null) { throwAssertionError(contextFailedToStartWhenExpecting("to get beans of type:%n <%s>", type)); } - return Assertions.assertThat(scope.getBeansOfType(getApplicationContext(), type)) - .as("Beans of type <%s> from <%s>", type, getApplicationContext()); + return assertThat(scope.getBeansOfType(getApplicationContext(), type)).as("Beans of type <%s> from <%s>", type, + getApplicationContext()); } /** @@ -482,7 +481,6 @@ public class ApplicationContextAssert * Limited to the current context. */ NO_ANCESTORS { - @Override String[] getBeanNamesForType(ApplicationContext applicationContext, Class type) { return applicationContext.getBeanNamesForType(type); @@ -499,7 +497,6 @@ public class ApplicationContextAssert * Consider the ancestor contexts as well as the current context. */ INCLUDE_ANCESTORS { - @Override String[] getBeanNamesForType(ApplicationContext applicationContext, Class type) { return BeanFactoryUtils.beanNamesForTypeIncludingAncestors(applicationContext, type); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java index d94644a71ee..723540acdd7 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactoryTests.java @@ -32,7 +32,6 @@ import io.rsocket.SocketAcceptor; import io.rsocket.transport.netty.client.TcpClientTransport; import io.rsocket.transport.netty.client.WebsocketClientTransport; import io.rsocket.util.DefaultPayload; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.mockito.InOrder; @@ -375,7 +374,7 @@ class NettyRSocketServerFactoryTests { } private HttpClient createHttpClient() { - Assertions.assertThat(this.server).isNotNull(); + assertThat(this.server).isNotNull(); InetSocketAddress address = this.server.address(); return HttpClient.create().host(address.getHostName()).port(address.getPort()); } @@ -389,7 +388,7 @@ class NettyRSocketServerFactoryTests { } private TcpClient createTcpClient() { - Assertions.assertThat(this.server).isNotNull(); + assertThat(this.server).isNotNull(); InetSocketAddress address = this.server.address(); return TcpClient.create().host(address.getHostName()).port(address.getPort()); }