Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the the check.
This commit is contained in:
@@ -278,8 +278,8 @@ public class ApplicationContextAssert<C extends ApplicationContext>
|
||||
"%nExpecting:%n <%s>%nsingle bean of type:%n <%s>%nbut found:%n <%s>",
|
||||
getApplicationContext(), type, names));
|
||||
}
|
||||
T bean = (names.length == 0 ? null
|
||||
: getApplicationContext().getBean(names[0], type));
|
||||
T bean = (names.length != 0 ? getApplicationContext().getBean(names[0], type)
|
||||
: null);
|
||||
return Assertions.assertThat(bean).as("Bean of type <%s> from <%s>", type,
|
||||
getApplicationContext());
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ public final class WebApplicationContextRunner extends
|
||||
*/
|
||||
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(
|
||||
Supplier<ConfigurableWebApplicationContext> contextFactory) {
|
||||
return (contextFactory == null ? null : () -> {
|
||||
return (contextFactory != null ? () -> {
|
||||
ConfigurableWebApplicationContext context = contextFactory.get();
|
||||
context.setServletContext(new MockServletContext());
|
||||
return context;
|
||||
});
|
||||
} : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public final class TestPropertyValues {
|
||||
}
|
||||
|
||||
protected String applySuffix(String name) {
|
||||
return (this.suffix == null ? name : name + "-" + this.suffix);
|
||||
return (this.suffix != null ? name + "-" + this.suffix : name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class TestRestTemplate {
|
||||
*/
|
||||
public TestRestTemplate(RestTemplateBuilder restTemplateBuilder, String username,
|
||||
String password, HttpClientOption... httpClientOptions) {
|
||||
this(restTemplateBuilder == null ? null : restTemplateBuilder.build(), username,
|
||||
this(restTemplateBuilder != null ? restTemplateBuilder.build() : null, username,
|
||||
password, httpClientOptions);
|
||||
}
|
||||
|
||||
@@ -138,8 +138,8 @@ public class TestRestTemplate {
|
||||
HttpClientOption... httpClientOptions) {
|
||||
Assert.notNull(restTemplate, "RestTemplate must not be null");
|
||||
this.httpClientOptions = httpClientOptions;
|
||||
if (getRequestFactoryClass(restTemplate).isAssignableFrom(
|
||||
HttpComponentsClientHttpRequestFactory.class)) {
|
||||
if (getRequestFactoryClass(restTemplate)
|
||||
.isAssignableFrom(HttpComponentsClientHttpRequestFactory.class)) {
|
||||
restTemplate.setRequestFactory(
|
||||
new CustomHttpComponentsClientHttpRequestFactory(httpClientOptions));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user