From 7380920ed486f2a5f9b7a8863fdf5887e7f013a3 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 5 Dec 2017 17:43:56 -0800 Subject: [PATCH] Remove wrong usage of commons-lang3 Closes gh-11267 --- .../AssertProviderApplicationContextInvocationHandler.java | 5 ++--- .../assertj/ApplicationContextAssertProviderTests.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertProviderApplicationContextInvocationHandler.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertProviderApplicationContextInvocationHandler.java index 67948df423..2be05c02f4 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertProviderApplicationContextInvocationHandler.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/AssertProviderApplicationContextInvocationHandler.java @@ -24,9 +24,8 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.function.Supplier; -import org.apache.commons.lang3.builder.ToStringBuilder; - import org.springframework.context.ApplicationContext; +import org.springframework.core.style.ToStringCreator; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; @@ -98,7 +97,7 @@ class AssertProviderApplicationContextInvocationHandler implements InvocationHan + this.applicationContextType.getName() + "[startupFailure=" + this.startupFailure.getClass().getName() + "]"; } - ToStringBuilder builder = new ToStringBuilder(this.applicationContext) + ToStringCreator builder = new ToStringCreator(this.applicationContext) .append("id", this.applicationContext.getId()) .append("applicationName", this.applicationContext.getApplicationName()) .append("beanDefinitionCount", diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java index e88ff857da..0b78be53fa 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProviderTests.java @@ -197,8 +197,8 @@ public class ApplicationContextAssertProviderTests { this.mockContextSupplier); assertThat(context.toString()) .startsWith( - "Started application org.springframework.context.ConfigurableApplicationContext$MockitoMock") - .endsWith("[id=,applicationName=,beanDefinitionCount=0]"); + "Started application [ConfigurableApplicationContext.MockitoMock") + .endsWith("id = [null], applicationName = [null], beanDefinitionCount = 0]"); } @Test