Commit 93382648 authored by Phillip Webb's avatar Phillip Webb

Formatting

parent 79922360
...@@ -64,8 +64,7 @@ public class SpringApplicationHierarchyTests { ...@@ -64,8 +64,7 @@ public class SpringApplicationHierarchyTests {
@EnableAutoConfiguration(exclude = { ElasticsearchDataAutoConfiguration.class, @EnableAutoConfiguration(exclude = { ElasticsearchDataAutoConfiguration.class,
ElasticsearchRepositoriesAutoConfiguration.class, ElasticsearchRepositoriesAutoConfiguration.class,
CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class,
Neo4jAutoConfiguration.class, Neo4jAutoConfiguration.class, RedisAutoConfiguration.class,
RedisAutoConfiguration.class,
RedisRepositoriesAutoConfiguration.class }, excludeName = { RedisRepositoriesAutoConfiguration.class }, excludeName = {
"org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" }) "org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
public static class Child { public static class Child {
...@@ -77,8 +76,7 @@ public class SpringApplicationHierarchyTests { ...@@ -77,8 +76,7 @@ public class SpringApplicationHierarchyTests {
ElasticsearchDataAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class,
ElasticsearchRepositoriesAutoConfiguration.class, ElasticsearchRepositoriesAutoConfiguration.class,
CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class, CassandraDataAutoConfiguration.class,
Neo4jAutoConfiguration.class, Neo4jAutoConfiguration.class, RedisAutoConfiguration.class,
RedisAutoConfiguration.class,
RedisRepositoriesAutoConfiguration.class }, excludeName = { RedisRepositoriesAutoConfiguration.class }, excludeName = {
"org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" }) "org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration" })
public static class Parent { public static class Parent {
......
...@@ -57,7 +57,8 @@ public class PrefixMetricGroupExporterTests { ...@@ -57,7 +57,8 @@ public class PrefixMetricGroupExporterTests {
this.reader.set(new Metric<Number>("counter.foo.bar", 1)); this.reader.set(new Metric<Number>("counter.foo.bar", 1));
this.exporter.setGroups(Collections.singleton("counter.foo")); this.exporter.setGroups(Collections.singleton("counter.foo"));
this.exporter.export(); this.exporter.export();
assertThat(this.writer.findAll("counter.foo").iterator().next().getValue()).isEqualTo(2L); assertThat(this.writer.findAll("counter.foo").iterator().next().getValue())
.isEqualTo(2L);
} }
@Test @Test
......
...@@ -143,8 +143,8 @@ public class EnableAutoConfigurationImportSelector ...@@ -143,8 +143,8 @@ public class EnableAutoConfigurationImportSelector
List<String> configurations = SpringFactoriesLoader.loadFactoryNames( List<String> configurations = SpringFactoriesLoader.loadFactoryNames(
getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader()); getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
Assert.notEmpty(configurations, Assert.notEmpty(configurations,
"No auto configuration classes found in META-INF/spring.factories. If you" + "No auto configuration classes found in META-INF/spring.factories. If you"
"are using a custom packaging, make sure that file is correct."); + "are using a custom packaging, make sure that file is correct.");
return configurations; return configurations;
} }
......
...@@ -100,7 +100,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit ...@@ -100,7 +100,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
+ matching); + matching);
} }
matchMessage.append("@ConditionalOnSingleCandidate ").append(spec) matchMessage.append("@ConditionalOnSingleCandidate ").append(spec)
.append(" found a primary candidate amongst the following ").append(matching); .append(" found a primary candidate amongst the following ")
.append(matching);
} }
if (metadata.isAnnotated(ConditionalOnMissingBean.class.getName())) { if (metadata.isAnnotated(ConditionalOnMissingBean.class.getName())) {
BeanSearchSpec spec = new BeanSearchSpec(context, metadata, BeanSearchSpec spec = new BeanSearchSpec(context, metadata,
......
...@@ -73,8 +73,9 @@ class OnClassCondition extends SpringBootCondition { ...@@ -73,8 +73,9 @@ class OnClassCondition extends SpringBootCondition {
} }
matchMessage.append(matchMessage.length() == 0 ? "" : " "); matchMessage.append(matchMessage.length() == 0 ? "" : " ");
matchMessage.append("@ConditionalOnMissing classes not found: ") matchMessage.append("@ConditionalOnMissing classes not found: ")
.append(StringUtils.collectionToCommaDelimitedString(getMatchingClasses( .append(StringUtils.collectionToCommaDelimitedString(
onMissingClasses, MatchType.MISSING, context))); getMatchingClasses(onMissingClasses, MatchType.MISSING,
context)));
} }
return ConditionOutcome.match(matchMessage.toString()); return ConditionOutcome.match(matchMessage.toString());
......
...@@ -83,8 +83,8 @@ class OnPropertyCondition extends SpringBootCondition { ...@@ -83,8 +83,8 @@ class OnPropertyCondition extends SpringBootCondition {
StringBuilder message = new StringBuilder("@ConditionalOnProperty "); StringBuilder message = new StringBuilder("@ConditionalOnProperty ");
if (!missingProperties.isEmpty()) { if (!missingProperties.isEmpty()) {
message.append("missing required properties ").append(expandNames(prefix, missingProperties)) message.append("missing required properties ")
.append(" "); .append(expandNames(prefix, missingProperties)).append(" ");
} }
if (!nonMatchingProperties.isEmpty()) { if (!nonMatchingProperties.isEmpty()) {
String expected = StringUtils.hasLength(havingValue) ? havingValue : "!false"; String expected = StringUtils.hasLength(havingValue) ? havingValue : "!false";
......
...@@ -18,4 +18,3 @@ ...@@ -18,4 +18,3 @@
* Auto-configuration for Spring Data Neo4j. * Auto-configuration for Spring Data Neo4j.
*/ */
package org.springframework.boot.autoconfigure.data.neo4j; package org.springframework.boot.autoconfigure.data.neo4j;
...@@ -188,7 +188,8 @@ public class ActiveMQProperties { ...@@ -188,7 +188,8 @@ public class ActiveMQProperties {
private Boolean trustAll; private Boolean trustAll;
/** /**
* Comma-separated list of specific packages to trust (when not trusting all packages). * Comma-separated list of specific packages to trust (when not trusting all
* packages).
*/ */
private List<String> trusted = new ArrayList<String>(); private List<String> trusted = new ArrayList<String>();
......
...@@ -153,7 +153,8 @@ public class EnableAutoConfigurationImportSelectorTests { ...@@ -153,7 +153,8 @@ public class EnableAutoConfigurationImportSelectorTests {
@Test @Test
public void propertyOverrideSetToTrue() throws Exception { public void propertyOverrideSetToTrue() throws Exception {
configureExclusions(new String[0], new String[0], new String[0]); configureExclusions(new String[0], new String[0], new String[0]);
this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, "true"); this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY,
"true");
String[] imports = this.importSelector.selectImports(this.annotationMetadata); String[] imports = this.importSelector.selectImports(this.annotationMetadata);
assertThat(imports).isNotEmpty(); assertThat(imports).isNotEmpty();
} }
...@@ -161,7 +162,8 @@ public class EnableAutoConfigurationImportSelectorTests { ...@@ -161,7 +162,8 @@ public class EnableAutoConfigurationImportSelectorTests {
@Test @Test
public void propertyOverrideSetToFalse() throws Exception { public void propertyOverrideSetToFalse() throws Exception {
configureExclusions(new String[0], new String[0], new String[0]); configureExclusions(new String[0], new String[0], new String[0]);
this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY, "false"); this.environment.setProperty(EnableAutoConfiguration.ENABLED_OVERRIDE_PROPERTY,
"false");
String[] imports = this.importSelector.selectImports(this.annotationMetadata); String[] imports = this.importSelector.selectImports(this.annotationMetadata);
assertThat(imports).isEmpty(); assertThat(imports).isEmpty();
} }
......
...@@ -61,12 +61,14 @@ public class IntegrationAutoConfigurationTests { ...@@ -61,12 +61,14 @@ public class IntegrationAutoConfigurationTests {
@Test @Test
public void parentContext() { public void parentContext() {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
this.context.register(JmxAutoConfiguration.class, IntegrationAutoConfiguration.class); this.context.register(JmxAutoConfiguration.class,
IntegrationAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
AnnotationConfigApplicationContext parent = this.context; AnnotationConfigApplicationContext parent = this.context;
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
this.context.setParent(parent); this.context.setParent(parent);
this.context.register(JmxAutoConfiguration.class, IntegrationAutoConfiguration.class); this.context.register(JmxAutoConfiguration.class,
IntegrationAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertThat(this.context.getBean(HeaderChannelRegistry.class)).isNotNull(); assertThat(this.context.getBean(HeaderChannelRegistry.class)).isNotNull();
((ConfigurableApplicationContext) this.context.getParent()).close(); ((ConfigurableApplicationContext) this.context.getParent()).close();
......
...@@ -40,8 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -40,8 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DirtiesContext @DirtiesContext
@SpringBootTest(webEnvironment = WebEnvironment.NONE, properties = { @SpringBootTest(webEnvironment = WebEnvironment.NONE, properties = { "env.foo=There",
"env.foo=There", "foo=World" }) "foo=World" })
public class MustacheStandaloneIntegrationTests { public class MustacheStandaloneIntegrationTests {
@Autowired @Autowired
......
...@@ -26,9 +26,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -26,9 +26,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.TypeExcludeFilter; import org.springframework.boot.context.TypeExcludeFilter;
/** /**
* Annotation that can be on tests to define a set of {@link TypeExcludeFilter} classes that * Annotation that can be on tests to define a set of {@link TypeExcludeFilter} classes
* should be applied to {@link SpringBootApplication @SpringBootApplication} component * that should be applied to {@link SpringBootApplication @SpringBootApplication}
* scanning. * component scanning.
* *
* @author Phillip Webb * @author Phillip Webb
* @since 1.4.0 * @since 1.4.0
......
...@@ -25,8 +25,8 @@ import java.lang.annotation.Target; ...@@ -25,8 +25,8 @@ import java.lang.annotation.Target;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
/** /**
* Annotation that can be applied to a test class to enable * Annotation that can be applied to a test class to enable auto-configuration of a
* auto-configuration of a {@link TestEntityManager}. * {@link TestEntityManager}.
* *
* @author Phillip Webb * @author Phillip Webb
* @see TestEntityManagerAutoConfiguration * @see TestEntityManagerAutoConfiguration
......
...@@ -47,9 +47,9 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -47,9 +47,9 @@ import org.springframework.transaction.annotation.Transactional;
* override these settings. * override these settings.
* <p> * <p>
* If you are looking to load your full application configuration, but use an embedded * If you are looking to load your full application configuration, but use an embedded
* database, you should consider {@link SpringBootTest @SpringBootTest} * database, you should consider {@link SpringBootTest @SpringBootTest} combined with
* combined with {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} rather than * {@link AutoConfigureTestDatabase @AutoConfigureTestDatabase} rather than this
* this annotation. * annotation.
* *
* @author Phillip Webb * @author Phillip Webb
* @see AutoConfigureTestDatabase * @see AutoConfigureTestDatabase
......
...@@ -37,8 +37,8 @@ import org.springframework.web.servlet.DispatcherServlet; ...@@ -37,8 +37,8 @@ import org.springframework.web.servlet.DispatcherServlet;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Base class for {@link SpringBootTest} tests configured to start an embedded * Base class for {@link SpringBootTest} tests configured to start an embedded servlet
* servlet container * container
* *
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
......
...@@ -26,8 +26,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -26,8 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/** /**
* Tests for {@link SpringBootTest} configured with * Tests for {@link SpringBootTest} configured with {@link WebEnvironment#DEFINED_PORT}.
* {@link WebEnvironment#DEFINED_PORT}.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
......
...@@ -26,16 +26,14 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -26,16 +26,14 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/** /**
* Tests for {@link SpringBootTest} configured with * Tests for {@link SpringBootTest} configured with {@link WebEnvironment#DEFINED_PORT}.
* {@link WebEnvironment#DEFINED_PORT}.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DirtiesContext @DirtiesContext
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "value=123" })
"value=123" })
public class SpringBootTestWebEnvironmentRandomPortTests public class SpringBootTestWebEnvironmentRandomPortTests
extends AbstractSpringBootTestEmbeddedWebEnvironmentTests { extends AbstractSpringBootTestEmbeddedWebEnvironmentTests {
......
...@@ -289,8 +289,7 @@ public class JsonContentAssertTests { ...@@ -289,8 +289,7 @@ public class JsonContentAssertTests {
} }
@Test @Test
public void isEqualToJsonWhenStringIsMatchingAndLenientShouldPass() public void isEqualToJsonWhenStringIsMatchingAndLenientShouldPass() throws Exception {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME, JSONCompareMode.LENIENT); assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME, JSONCompareMode.LENIENT);
} }
...@@ -329,8 +328,7 @@ public class JsonContentAssertTests { ...@@ -329,8 +328,7 @@ public class JsonContentAssertTests {
} }
@Test @Test
public void isEqualToJsonWhenBytesAreMatchingAndLenientShouldPass() public void isEqualToJsonWhenBytesAreMatchingAndLenientShouldPass() throws Exception {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(), assertThat(forJson(SOURCE)).isEqualToJson(LENIENT_SAME.getBytes(),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
......
...@@ -22,8 +22,8 @@ import org.springframework.context.annotation.Import; ...@@ -22,8 +22,8 @@ import org.springframework.context.annotation.Import;
/** /**
* Config for {@link MockBeanOnTestFieldForExistingBeanIntegrationTests} and * Config for {@link MockBeanOnTestFieldForExistingBeanIntegrationTests} and
* {@link MockBeanOnTestFieldForExistingBeanCacheIntegrationTests}. Extracted to a shared config * {@link MockBeanOnTestFieldForExistingBeanCacheIntegrationTests}. Extracted to a shared
* to trigger caching. * config to trigger caching.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
......
...@@ -615,9 +615,8 @@ public class JettyEmbeddedServletContainerFactory ...@@ -615,9 +615,8 @@ public class JettyEmbeddedServletContainerFactory
} }
/** /**
* Set a Jetty {@link ThreadPool} that should be used by the {@link Server}. * Set a Jetty {@link ThreadPool} that should be used by the {@link Server}. If set to
* If set to {@code null} (default), the {@link Server} creates * {@code null} (default), the {@link Server} creates a {@link ThreadPool} implicitly.
* a {@link ThreadPool} implicitly.
* @param threadPool a Jetty ThreadPool to be used * @param threadPool a Jetty ThreadPool to be used
*/ */
public void setThreadPool(ThreadPool threadPool) { public void setThreadPool(ThreadPool threadPool) {
...@@ -898,7 +897,8 @@ public class JettyEmbeddedServletContainerFactory ...@@ -898,7 +897,8 @@ public class JettyEmbeddedServletContainerFactory
public Server createServer(ThreadPool threadPool) { public Server createServer(ThreadPool threadPool) {
Server server = new Server(); Server server = new Server();
try { try {
ReflectionUtils.findMethod(Server.class, "setThreadPool", ThreadPool.class) ReflectionUtils
.findMethod(Server.class, "setThreadPool", ThreadPool.class)
.invoke(server, threadPool); .invoke(server, threadPool);
} }
catch (Exception e) { catch (Exception e) {
......
...@@ -76,8 +76,8 @@ public abstract class JsonObjectDeserializer<T> ...@@ -76,8 +76,8 @@ public abstract class JsonObjectDeserializer<T>
throws IOException; throws IOException;
/** /**
* Helper method to extract a value from the given {@code jsonNode} or return {@code null} * Helper method to extract a value from the given {@code jsonNode} or return
* when the node itself is {@code null}. * {@code null} when the node itself is {@code null}.
* @param jsonNode the source node (may be {@code null} * @param jsonNode the source node (may be {@code null}
* @param type the data type. May be {@link String}, {@link Boolean}, {@link Long}, * @param type the data type. May be {@link String}, {@link Boolean}, {@link Long},
* {@link Integer}, {@link Short}, {@link Double}, {@link Float}, {@link BigDecimal} * {@link Integer}, {@link Short}, {@link Double}, {@link Float}, {@link BigDecimal}
......
...@@ -157,7 +157,8 @@ public class ImageBannerTests { ...@@ -157,7 +157,8 @@ public class ImageBannerTests {
} }
@Test @Test
public void printBannerWhenHasMarginPropertyShouldPrintSizedMargin() throws Exception { public void printBannerWhenHasMarginPropertyShouldPrintSizedMargin()
throws Exception {
AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER); AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
String banner = printBanner("large.gif", "banner.image.margin=4"); String banner = printBanner("large.gif", "banner.image.margin=4");
String[] lines = banner.split(NEW_LINE); String[] lines = banner.split(NEW_LINE);
......
...@@ -72,7 +72,8 @@ public class SpringBootJoranConfiguratorTests { ...@@ -72,7 +72,8 @@ public class SpringBootJoranConfiguratorTests {
@After @After
public void reset() { public void reset() {
this.context.stop(); this.context.stop();
new BasicConfigurator().configure((LoggerContext) LoggerFactory.getILoggerFactory()); new BasicConfigurator()
.configure((LoggerContext) LoggerFactory.getILoggerFactory());
} }
@Test @Test
......
...@@ -58,12 +58,12 @@ public class NodeEntityScanTests { ...@@ -58,12 +58,12 @@ public class NodeEntityScanTests {
this.thrown.expectMessage("Unable to configure " this.thrown.expectMessage("Unable to configure "
+ "SessionFactoryFactoryBean from @NodeEntityScan, " + "SessionFactoryFactoryBean from @NodeEntityScan, "
+ "ensure an appropriate bean is registered."); + "ensure an appropriate bean is registered.");
this.context = new AnnotationConfigApplicationContext(MissingSessionFactory.class); this.context = new AnnotationConfigApplicationContext(
MissingSessionFactory.class);
} }
private void assertSetPackagesToScan(String... expected) { private void assertSetPackagesToScan(String... expected) {
String[] actual = this.context String[] actual = this.context.getBean(TestSessionFactoryProvider.class)
.getBean(TestSessionFactoryProvider.class)
.getPackagesToScan(); .getPackagesToScan();
assertThat(actual).isEqualTo(expected); assertThat(actual).isEqualTo(expected);
} }
...@@ -87,9 +87,7 @@ public class NodeEntityScanTests { ...@@ -87,9 +87,7 @@ public class NodeEntityScanTests {
static class MissingSessionFactory { static class MissingSessionFactory {
} }
private static class TestSessionFactoryProvider extends SessionFactoryProvider {
private static class TestSessionFactoryProvider
extends SessionFactoryProvider {
private String[] packagesToScan; private String[] packagesToScan;
......
...@@ -63,7 +63,8 @@ public class InternalOutputCapture implements TestRule { ...@@ -63,7 +63,8 @@ public class InternalOutputCapture implements TestRule {
try { try {
if (!InternalOutputCapture.this.matchers.isEmpty()) { if (!InternalOutputCapture.this.matchers.isEmpty()) {
String output = InternalOutputCapture.this.toString(); String output = InternalOutputCapture.this.toString();
Assert.assertThat(output, allOf(InternalOutputCapture.this.matchers)); Assert.assertThat(output,
allOf(InternalOutputCapture.this.matchers));
} }
} }
finally { finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment