* pr/18438: Polish 'Simplify some code' Simplify some code Closes gh-18438
@ -56,7 +56,7 @@ class OverrideAutoConfigurationContextCustomizerFactory implements ContextCustom
@Override
public boolean equals(Object obj) {
return (obj != null && obj.getClass() == getClass());
return (obj != null) && (obj.getClass() == getClass());
}
@ -71,8 +71,8 @@ class TypeExcludeFiltersContextCustomizer implements ContextCustomizer {
return (obj != null && getClass() == obj.getClass()
&& this.filters.equals(((TypeExcludeFiltersContextCustomizer) obj).filters));
return (obj != null) && (getClass() == obj.getClass())
&& this.filters.equals(((TypeExcludeFiltersContextCustomizer) obj).filters);
@ -57,8 +57,8 @@ class PropertyMappingContextCustomizer implements ContextCustomizer {
&& this.propertySource.equals(((PropertyMappingContextCustomizer) obj).propertySource));
&& this.propertySource.equals(((PropertyMappingContextCustomizer) obj).propertySource);
@ -132,8 +132,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
private void addConfigAttributesClasses(ContextConfigurationAttributes configAttributes, Class<?>[] classes) {
List<Class<?>> combined = new ArrayList<>();
combined.addAll(Arrays.asList(classes));
List<Class<?>> combined = new ArrayList<>(Arrays.asList(classes));
if (configAttributes.getClasses() != null) {
combined.addAll(Arrays.asList(configAttributes.getClasses()));
@ -37,13 +37,7 @@ class ExcludeFilterContextCustomizer implements ContextCustomizer {
if (obj == this) {
return true;
if (obj == null || getClass() != obj.getClass()) {
return false;
return (obj != null) && (getClass() == obj.getClass());
@ -80,10 +80,7 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa
if (obj == null || obj.getClass() != getClass()) {
@ -209,7 +209,7 @@ class OutputCapture implements CapturedOutput {
private static PrintStream getSystemStream(PrintStream printStream) {
while (printStream instanceof PrintStreamCapture) {
return ((PrintStreamCapture) printStream).getParent();
printStream = ((PrintStreamCapture) printStream).getParent();
return printStream;
@ -78,10 +78,7 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer {
@ -17,7 +17,6 @@
package org.springframework.boot.test.web.htmlunit;
import java.io.IOException;
import java.net.MalformedURLException;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.Page;
@ -43,8 +42,7 @@ public class LocalHostWebClient extends WebClient {
public <P extends Page> P getPage(String url)
throws IOException, FailingHttpStatusCodeException, MalformedURLException {
public <P extends Page> P getPage(String url) throws IOException, FailingHttpStatusCodeException {
if (url.startsWith("/")) {
String port = this.environment.getProperty("local.server.port", "8080");
url = "http://localhost:" + port + url;
@ -79,7 +79,7 @@ class WebTestClientContextCustomizer implements ContextCustomizer {
@ -92,7 +92,7 @@ class MockitoTestExecutionListenerTests {
given(mockTestContext.getAttribute(DependencyInjectionTestExecutionListener.REINJECT_DEPENDENCIES_ATTRIBUTE))
.willReturn(Boolean.TRUE);
this.listener.beforeTestMethod(mockTestContext);
verify(this.postProcessor).inject(this.fieldCaptor.capture(), eq(instance), (MockDefinition) any());
verify(this.postProcessor).inject(this.fieldCaptor.capture(), eq(instance), any(MockDefinition.class));
assertThat(this.fieldCaptor.getValue().getName()).isEqualTo("mockBean");