This commit is contained in:
Stephane Nicoll
2017-12-12 11:57:24 +01:00
parent 97c91eee94
commit 23218add90
615 changed files with 2832 additions and 3224 deletions

View File

@@ -172,22 +172,19 @@ public class AutoConfigurationImportSelectorTests {
}
@Test
public void nonAutoConfigurationClassExclusionsShouldThrowException()
throws Exception {
public void nonAutoConfigurationClassExclusionsShouldThrowException() {
this.expected.expect(IllegalStateException.class);
selectImports(EnableAutoConfigurationWithFaultyClassExclude.class);
}
@Test
public void nonAutoConfigurationClassNameExclusionsWhenPresentOnClassPathShouldThrowException()
throws Exception {
public void nonAutoConfigurationClassNameExclusionsWhenPresentOnClassPathShouldThrowException() {
this.expected.expect(IllegalStateException.class);
selectImports(EnableAutoConfigurationWithFaultyClassNameExclude.class);
}
@Test
public void nonAutoConfigurationPropertyExclusionsWhenPresentOnClassPathShouldThrowException()
throws Exception {
public void nonAutoConfigurationPropertyExclusionsWhenPresentOnClassPathShouldThrowException() {
this.environment.setProperty("spring.autoconfigure.exclude",
"org.springframework.boot.autoconfigure."
+ "AutoConfigurationImportSelectorTests.TestConfiguration");
@@ -196,8 +193,7 @@ public class AutoConfigurationImportSelectorTests {
}
@Test
public void nameAndPropertyExclusionsWhenNotPresentOnClasspathShouldNotThrowException()
throws Exception {
public void nameAndPropertyExclusionsWhenNotPresentOnClasspathShouldNotThrowException() {
this.environment.setProperty("spring.autoconfigure.exclude",
"org.springframework.boot.autoconfigure.DoesNotExist2");
selectImports(EnableAutoConfigurationWithAbsentClassNameExclude.class);
@@ -208,7 +204,7 @@ public class AutoConfigurationImportSelectorTests {
}
@Test
public void filterShouldFilterImports() throws Exception {
public void filterShouldFilterImports() {
String[] defaultImports = selectImports(BasicEnableAutoConfiguration.class);
this.filters.add(new TestAutoConfigurationImportFilter(defaultImports, 1));
this.filters.add(new TestAutoConfigurationImportFilter(defaultImports, 3, 4));
@@ -219,7 +215,7 @@ public class AutoConfigurationImportSelectorTests {
}
@Test
public void filterShouldSupportAware() throws Exception {
public void filterShouldSupportAware() {
TestAutoConfigurationImportFilter filter = new TestAutoConfigurationImportFilter(
new String[] {});
this.filters.add(filter);

View File

@@ -30,63 +30,63 @@ import static org.assertj.core.api.Assertions.assertThat;
public class AutoConfigurationMetadataLoaderTests {
@Test
public void loadShouldLoadProperties() throws Exception {
public void loadShouldLoadProperties() {
assertThat(load()).isNotNull();
}
@Test
public void wasProcessedWhenProcessedShouldReturnTrue() throws Exception {
public void wasProcessedWhenProcessedShouldReturnTrue() {
assertThat(load().wasProcessed("test")).isTrue();
}
@Test
public void wasProcessedWhenNotProcessedShouldReturnFalse() throws Exception {
public void wasProcessedWhenNotProcessedShouldReturnFalse() {
assertThat(load().wasProcessed("testx")).isFalse();
}
@Test
public void getIntegerShouldReturnValue() throws Exception {
public void getIntegerShouldReturnValue() {
assertThat(load().getInteger("test", "int")).isEqualTo(123);
}
@Test
public void getIntegerWhenMissingShouldReturnNull() throws Exception {
public void getIntegerWhenMissingShouldReturnNull() {
assertThat(load().getInteger("test", "intx")).isNull();
}
@Test
public void getIntegerWithDefaultWhenMissingShouldReturnDefault() throws Exception {
public void getIntegerWithDefaultWhenMissingShouldReturnDefault() {
assertThat(load().getInteger("test", "intx", 345)).isEqualTo(345);
}
@Test
public void getSetShouldReturnValue() throws Exception {
public void getSetShouldReturnValue() {
assertThat(load().getSet("test", "set")).containsExactly("a", "b", "c");
}
@Test
public void getSetWhenMissingShouldReturnNull() throws Exception {
public void getSetWhenMissingShouldReturnNull() {
assertThat(load().getSet("test", "setx")).isNull();
}
@Test
public void getSetWithDefaultWhenMissingShouldReturnDefault() throws Exception {
public void getSetWithDefaultWhenMissingShouldReturnDefault() {
assertThat(load().getSet("test", "setx", Collections.singleton("x")))
.containsExactly("x");
}
@Test
public void getShouldReturnValue() throws Exception {
public void getShouldReturnValue() {
assertThat(load().get("test", "string")).isEqualTo("abc");
}
@Test
public void getWhenMissingShouldReturnNull() throws Exception {
public void getWhenMissingShouldReturnNull() {
assertThat(load().get("test", "stringx")).isNull();
}
@Test
public void getWithDefaultWhenMissingShouldReturnDefault() throws Exception {
public void getWithDefaultWhenMissingShouldReturnDefault() {
assertThat(load().get("test", "stringx", "xyz")).isEqualTo("xyz");
}

View File

@@ -52,7 +52,7 @@ public class AutoConfigurationPackagesTests {
}
@Test
public void getWithoutSet() throws Exception {
public void getWithoutSet() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
EmptyConfig.class);
this.thrown.expect(IllegalStateException.class);

View File

@@ -45,7 +45,7 @@ public class AutoConfigurationReproTests {
}
@Test
public void doesNotEarlyInitializeFactoryBeans() throws Exception {
public void doesNotEarlyInitializeFactoryBeans() {
SpringApplication application = new SpringApplication(EarlyInitConfig.class,
PropertySourcesPlaceholderConfigurer.class,
ServletWebServerFactoryAutoConfiguration.class);

View File

@@ -87,60 +87,59 @@ public class AutoConfigurationSorterTests {
}
@Test
public void byOrderAnnotation() throws Exception {
public void byOrderAnnotation() {
List<String> actual = this.sorter
.getInPriorityOrder(Arrays.asList(LOWEST, HIGHEST, DEFAULT));
assertThat(actual).containsExactly(HIGHEST, DEFAULT, LOWEST);
}
@Test
public void byAutoConfigureAfter() throws Exception {
public void byAutoConfigureAfter() {
List<String> actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B, C));
assertThat(actual).containsExactly(C, B, A);
}
@Test
public void byAutoConfigureBefore() throws Exception {
public void byAutoConfigureBefore() {
List<String> actual = this.sorter.getInPriorityOrder(Arrays.asList(X, Y, Z));
assertThat(actual).containsExactly(Z, Y, X);
}
@Test
public void byAutoConfigureAfterDoubles() throws Exception {
public void byAutoConfigureAfterDoubles() {
List<String> actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B, C, E));
assertThat(actual).containsExactly(C, E, B, A);
}
@Test
public void byAutoConfigureMixedBeforeAndAfter() throws Exception {
public void byAutoConfigureMixedBeforeAndAfter() {
List<String> actual = this.sorter
.getInPriorityOrder(Arrays.asList(A, B, C, W, X));
assertThat(actual).containsExactly(C, W, B, A, X);
}
@Test
public void byAutoConfigureMixedBeforeAndAfterWithClassNames() throws Exception {
public void byAutoConfigureMixedBeforeAndAfterWithClassNames() {
List<String> actual = this.sorter
.getInPriorityOrder(Arrays.asList(A2, B, C, W2, X));
assertThat(actual).containsExactly(C, W2, B, A2, X);
}
@Test
public void byAutoConfigureMixedBeforeAndAfterWithDifferentInputOrder()
throws Exception {
public void byAutoConfigureMixedBeforeAndAfterWithDifferentInputOrder() {
List<String> actual = this.sorter
.getInPriorityOrder(Arrays.asList(W, X, A, B, C));
assertThat(actual).containsExactly(C, W, B, A, X);
}
@Test
public void byAutoConfigureAfterWithMissing() throws Exception {
public void byAutoConfigureAfterWithMissing() {
List<String> actual = this.sorter.getInPriorityOrder(Arrays.asList(A, B));
assertThat(actual).containsExactly(B, A);
}
@Test
public void byAutoConfigureAfterWithCycle() throws Exception {
public void byAutoConfigureAfterWithCycle() {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("AutoConfigure cycle detected");
this.sorter.getInPriorityOrder(Arrays.asList(A, B, C, D));

View File

@@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class AutoConfigurationsTests {
@Test
public void ofShouldCreateOrderedConfigurations() throws Exception {
public void ofShouldCreateOrderedConfigurations() {
Configurations configurations = AutoConfigurations.of(AutoConfigureA.class,
AutoConfigureB.class);
assertThat(Configurations.getClasses(configurations))

View File

@@ -45,13 +45,13 @@ public class ImportAutoConfigurationTests {
}
@Test
public void classesAsAnAlias() throws Exception {
public void classesAsAnAlias() {
assertThat(getImportedConfigBeans(AnotherConfigUsingClasses.class))
.containsExactly("ConfigA", "ConfigB", "ConfigC", "ConfigD");
}
@Test
public void excluding() throws Exception {
public void excluding() {
assertThat(getImportedConfigBeans(ExcludingConfig.class))
.containsExactly("ConfigA", "ConfigB", "ConfigD");
}

View File

@@ -69,8 +69,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests {
SpringApplicationAdminJmxAutoConfiguration.class));
@Test
public void notRegisteredByDefault()
throws MalformedObjectNameException, InstanceNotFoundException {
public void notRegisteredByDefault() {
this.contextRunner.run((context) -> {
this.thrown.expect(InstanceNotFoundException.class);
this.server.getObjectInstance(createDefaultObjectName());
@@ -78,7 +77,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests {
}
@Test
public void registeredWithProperty() throws Exception {
public void registeredWithProperty() {
this.contextRunner.withPropertyValues(ENABLE_ADMIN_PROP).run((context) -> {
ObjectName objectName = createDefaultObjectName();
ObjectInstance objectInstance = this.server.getObjectInstance(objectName);
@@ -88,7 +87,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests {
}
@Test
public void registerWithCustomJmxName() throws InstanceNotFoundException {
public void registerWithCustomJmxName() {
String customJmxName = "org.acme:name=FooBar";
this.contextRunner
.withSystemProperties(
@@ -125,7 +124,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests {
}
@Test
public void onlyRegisteredOnceWhenThereIsAChildContext() throws Exception {
public void onlyRegisteredOnceWhenThereIsAChildContext() {
SpringApplicationBuilder parentBuilder = new SpringApplicationBuilder()
.web(WebApplicationType.NONE)
.sources(MultipleMBeanExportersConfiguration.class,

View File

@@ -518,7 +518,7 @@ public class RabbitAutoConfigurationTests {
}
@Test
public void enableRabbitAutomatically() throws Exception {
public void enableRabbitAutomatically() {
this.contextRunner.withUserConfiguration(NoEnableRabbitConfiguration.class)
.run((context) -> {
assertThat(context).hasBean(
@@ -595,7 +595,7 @@ public class RabbitAutoConfigurationTests {
}
@Test
public void enableSslWithInvalidKeystoreTypeShouldFail() throws Exception {
public void enableSslWithInvalidKeystoreTypeShouldFail() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
"spring.rabbitmq.ssl.keyStore=foo",
@@ -609,7 +609,7 @@ public class RabbitAutoConfigurationTests {
}
@Test
public void enableSslWithInvalidTrustStoreTypeShouldFail() throws Exception {
public void enableSslWithInvalidTrustStoreTypeShouldFail() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
"spring.rabbitmq.ssl.trustStore=bar",
@@ -623,7 +623,7 @@ public class RabbitAutoConfigurationTests {
}
@Test
public void enableSslWithKeystoreTypeAndTrustStoreTypeShouldWork() throws Exception {
public void enableSslWithKeystoreTypeAndTrustStoreTypeShouldWork() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.ssl.enabled:true",
"spring.rabbitmq.ssl.keyStore=/org/springframework/boot/autoconfigure/amqp/test.jks",

View File

@@ -29,7 +29,6 @@ import org.junit.rules.ExpectedException;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionException;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.JobRegistry;
@@ -82,7 +81,7 @@ public class BatchAutoConfigurationTests {
TransactionAutoConfiguration.class));
@Test
public void testDefaultContext() throws Exception {
public void testDefaultContext() {
this.contextRunner.withUserConfiguration(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(JobLauncher.class);
@@ -96,7 +95,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testNoDatabase() throws Exception {
public void testNoDatabase() {
this.contextRunner.withUserConfiguration(TestCustomConfiguration.class)
.run((context) -> {
assertThat(context).hasSingleBean(JobLauncher.class);
@@ -106,7 +105,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testNoBatchConfiguration() throws Exception {
public void testNoBatchConfiguration() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class,
EmbeddedDataSourceConfiguration.class).run((context) -> {
assertThat(context).doesNotHaveBean(JobLauncher.class);
@@ -115,7 +114,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testDefinesAndLaunchesJob() throws Exception {
public void testDefinesAndLaunchesJob() {
this.contextRunner.withUserConfiguration(JobConfiguration.class,
EmbeddedDataSourceConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(JobLauncher.class);
@@ -126,7 +125,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testDefinesAndLaunchesNamedJob() throws Exception {
public void testDefinesAndLaunchesNamedJob() {
this.contextRunner
.withUserConfiguration(NamedJobConfigurationWithRegisteredJob.class,
EmbeddedDataSourceConfiguration.class)
@@ -140,7 +139,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testDefinesAndLaunchesLocalJob() throws Exception {
public void testDefinesAndLaunchesLocalJob() {
this.contextRunner
.withUserConfiguration(NamedJobConfigurationWithLocalJob.class,
EmbeddedDataSourceConfiguration.class)
@@ -155,7 +154,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testDisableLaunchesJob() throws Exception {
public void testDisableLaunchesJob() {
this.contextRunner
.withUserConfiguration(JobConfiguration.class,
EmbeddedDataSourceConfiguration.class)
@@ -166,7 +165,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testDisableSchemaLoader() throws Exception {
public void testDisableSchemaLoader() {
this.contextRunner
.withUserConfiguration(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class)
@@ -184,7 +183,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testUsingJpa() throws Exception {
public void testUsingJpa() {
this.contextRunner.withUserConfiguration(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class,
HibernateJpaAutoConfiguration.class).run((context) -> {
@@ -203,7 +202,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testRenamePrefix() throws Exception {
public void testRenamePrefix() {
this.contextRunner
.withUserConfiguration(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class,
@@ -228,7 +227,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testCustomizeJpaTransactionManagerUsingProperties() throws Exception {
public void testCustomizeJpaTransactionManagerUsingProperties() {
this.contextRunner
.withUserConfiguration(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class,
@@ -246,8 +245,7 @@ public class BatchAutoConfigurationTests {
}
@Test
public void testCustomizeDataSourceTransactionManagerUsingProperties()
throws Exception {
public void testCustomizeDataSourceTransactionManagerUsingProperties() {
this.contextRunner
.withUserConfiguration(TestConfiguration.class,
EmbeddedDataSourceConfiguration.class)
@@ -292,12 +290,12 @@ public class BatchAutoConfigurationTests {
}
@Override
public PlatformTransactionManager getTransactionManager() throws Exception {
public PlatformTransactionManager getTransactionManager() {
return new ResourcelessTransactionManager();
}
@Override
public JobLauncher getJobLauncher() throws Exception {
public JobLauncher getJobLauncher() {
SimpleJobLauncher launcher = new SimpleJobLauncher();
launcher.setJobRepository(this.jobRepository);
return launcher;
@@ -344,8 +342,7 @@ public class BatchAutoConfigurationTests {
}
@Override
protected void doExecute(JobExecution execution)
throws JobExecutionException {
protected void doExecute(JobExecution execution) {
execution.setStatus(BatchStatus.COMPLETED);
}
};
@@ -376,8 +373,7 @@ public class BatchAutoConfigurationTests {
}
@Override
protected void doExecute(JobExecution execution)
throws JobExecutionException {
protected void doExecute(JobExecution execution) {
execution.setStatus(BatchStatus.COMPLETED);
}
};
@@ -408,8 +404,7 @@ public class BatchAutoConfigurationTests {
}
@Override
protected void doExecute(JobExecution execution)
throws JobExecutionException {
protected void doExecute(JobExecution execution) {
execution.setStatus(BatchStatus.COMPLETED);
}
};

View File

@@ -54,7 +54,7 @@ public class BatchAutoConfigurationWithoutJpaTests {
TransactionAutoConfiguration.class));
@Test
public void jdbcWithDefaultSettings() throws Exception {
public void jdbcWithDefaultSettings() {
this.contextRunner
.withUserConfiguration(DefaultConfiguration.class,
EmbeddedDataSourceConfiguration.class)
@@ -80,7 +80,7 @@ public class BatchAutoConfigurationWithoutJpaTests {
}
@Test
public void jdbcWithCustomPrefix() throws Exception {
public void jdbcWithCustomPrefix() {
this.contextRunner
.withUserConfiguration(DefaultConfiguration.class,
EmbeddedDataSourceConfiguration.class)

View File

@@ -67,7 +67,7 @@ public class JobLauncherCommandLineRunnerTests {
private Step step;
@Before
public void init() throws Exception {
public void init() {
this.context.register(BatchConfiguration.class);
this.context.refresh();
JobRepository jobRepository = this.context.getBean(JobRepository.class);
@@ -167,17 +167,17 @@ public class JobLauncherCommandLineRunnerTests {
}
@Override
public JobRepository getJobRepository() throws Exception {
public JobRepository getJobRepository() {
return this.jobRepository;
}
@Override
public PlatformTransactionManager getTransactionManager() throws Exception {
public PlatformTransactionManager getTransactionManager() {
return this.transactionManager;
}
@Override
public JobLauncher getJobLauncher() throws Exception {
public JobLauncher getJobLauncher() {
SimpleJobLauncher launcher = new SimpleJobLauncher();
launcher.setJobRepository(this.jobRepository);
launcher.setTaskExecutor(new SyncTaskExecutor());

View File

@@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.cache;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -123,7 +122,7 @@ public class CacheAutoConfigurationTests {
}
@Test
public void cacheResolverFromSupportBackOff() throws Exception {
public void cacheResolverFromSupportBackOff() {
this.contextRunner
.withUserConfiguration(CustomCacheResolverFromSupportConfiguration.class)
.run((context) -> assertThat(context)
@@ -131,7 +130,7 @@ public class CacheAutoConfigurationTests {
}
@Test
public void customCacheResolverCanBeDefined() throws Exception {
public void customCacheResolverCanBeDefined() {
this.contextRunner.withUserConfiguration(SpecificCacheResolverConfiguration.class)
.withPropertyValues("spring.cache.type=simple").run((context) -> {
getCacheManager(context, ConcurrentMapCacheManager.class);
@@ -515,7 +514,7 @@ public class CacheAutoConfigurationTests {
}
@Test
public void ehcache3AsJCacheWithConfig() throws IOException {
public void ehcache3AsJCacheWithConfig() {
String cachingProviderFqn = EhcacheCachingProvider.class.getName();
String configLocation = "ehcache3.xml";
this.contextRunner.withUserConfiguration(DefaultCacheConfiguration.class)
@@ -571,7 +570,7 @@ public class CacheAutoConfigurationTests {
}
@Test
public void hazelcastCacheWithHazelcastAutoConfiguration() throws IOException {
public void hazelcastCacheWithHazelcastAutoConfiguration() {
String hazelcastConfig = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml";
this.contextRunner
.withConfiguration(
@@ -616,7 +615,7 @@ public class CacheAutoConfigurationTests {
}
@Test
public void hazelcastAsJCacheWithConfig() throws IOException {
public void hazelcastAsJCacheWithConfig() {
String cachingProviderFqn = HazelcastCachingProvider.class.getName();
try {
String configLocation = "org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml";
@@ -639,7 +638,7 @@ public class CacheAutoConfigurationTests {
}
@Test
public void hazelcastAsJCacheWithExistingHazelcastInstance() throws IOException {
public void hazelcastAsJCacheWithExistingHazelcastInstance() {
String cachingProviderFqn = HazelcastCachingProvider.class.getName();
this.contextRunner
.withConfiguration(
@@ -722,7 +721,7 @@ public class CacheAutoConfigurationTests {
}
@Test
public void infinispanAsJCacheWithConfig() throws IOException {
public void infinispanAsJCacheWithConfig() {
String cachingProviderClassName = JCachingProvider.class.getName();
String configLocation = "infinispan.xml";
this.contextRunner.withUserConfiguration(DefaultCacheConfiguration.class)

View File

@@ -50,7 +50,7 @@ public class CacheManagerCustomizersTests {
}
@Test
public void customizeShouldCheckGeneric() throws Exception {
public void customizeShouldCheckGeneric() {
List<TestCustomizer<?>> list = new ArrayList<>();
list.add(new TestCustomizer<>());
list.add(new TestConcurrentMapCacheManagerCustomizer());

View File

@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class CloudAutoConfigurationTests {
@Test
public void testOrder() throws Exception {
public void testOrder() {
TestAutoConfigurationSorter sorter = new TestAutoConfigurationSorter(
new CachingMetadataReaderFactory());
Collection<String> classNames = new ArrayList<>();

View File

@@ -38,24 +38,24 @@ public class AllNestedConditionsTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();
@Test
public void neither() throws Exception {
public void neither() {
this.contextRunner.withUserConfiguration(Config.class).run(match(false));
}
@Test
public void propertyA() throws Exception {
public void propertyA() {
this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("a:a")
.run(match(false));
}
@Test
public void propertyB() throws Exception {
public void propertyB() {
this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("b:b")
.run(match(false));
}
@Test
public void both() throws Exception {
public void both() {
this.contextRunner.withUserConfiguration(Config.class)
.withPropertyValues("a:a", "b:b").run(match(true));
}

View File

@@ -41,24 +41,24 @@ public class AnyNestedConditionTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();
@Test
public void neither() throws Exception {
public void neither() {
this.contextRunner.withUserConfiguration(Config.class).run(match(false));
}
@Test
public void propertyA() throws Exception {
public void propertyA() {
this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("a:a")
.run(match(true));
}
@Test
public void propertyB() throws Exception {
public void propertyB() {
this.contextRunner.withUserConfiguration(Config.class).withPropertyValues("b:b")
.run(match(true));
}
@Test
public void both() throws Exception {
public void both() {
this.contextRunner.withUserConfiguration(Config.class)
.withPropertyValues("a:a", "b:b").run(match(true));
}

View File

@@ -49,7 +49,7 @@ public class ConditionEvaluationReportAutoConfigurationImportListenerTests {
}
@Test
public void shouldBeInSpringFactories() throws Exception {
public void shouldBeInSpringFactories() {
List<AutoConfigurationImportListener> factories = SpringFactoriesLoader
.loadFactories(AutoConfigurationImportListener.class, null);
assertThat(factories).hasAtLeastOneElementOfType(
@@ -57,7 +57,7 @@ public class ConditionEvaluationReportAutoConfigurationImportListenerTests {
}
@Test
public void onAutoConfigurationImportEventShouldRecordCandidates() throws Exception {
public void onAutoConfigurationImportEventShouldRecordCandidates() {
List<String> candidateConfigurations = Collections.singletonList("Test");
Set<String> exclusions = Collections.emptySet();
AutoConfigurationImportEvent event = new AutoConfigurationImportEvent(this,
@@ -70,7 +70,7 @@ public class ConditionEvaluationReportAutoConfigurationImportListenerTests {
}
@Test
public void onAutoConfigurationImportEventShouldRecordExclusions() throws Exception {
public void onAutoConfigurationImportEventShouldRecordExclusions() {
List<String> candidateConfigurations = Collections.emptyList();
Set<String> exclusions = Collections.singleton("Test");
AutoConfigurationImportEvent event = new AutoConfigurationImportEvent(this,

View File

@@ -84,13 +84,13 @@ public class ConditionEvaluationReportTests {
}
@Test
public void get() throws Exception {
public void get() {
assertThat(this.report).isNotEqualTo(nullValue());
assertThat(this.report).isSameAs(ConditionEvaluationReport.get(this.beanFactory));
}
@Test
public void parent() throws Exception {
public void parent() {
this.beanFactory.setParentBeanFactory(new DefaultListableBeanFactory());
ConditionEvaluationReport.get((ConfigurableListableBeanFactory) this.beanFactory
.getParentBeanFactory());
@@ -106,7 +106,7 @@ public class ConditionEvaluationReportTests {
}
@Test
public void parentBottomUp() throws Exception {
public void parentBottomUp() {
this.beanFactory = new DefaultListableBeanFactory(); // NB: overrides setup
this.beanFactory.setParentBeanFactory(new DefaultListableBeanFactory());
ConditionEvaluationReport.get((ConfigurableListableBeanFactory) this.beanFactory
@@ -119,7 +119,7 @@ public class ConditionEvaluationReportTests {
}
@Test
public void recordConditionEvaluations() throws Exception {
public void recordConditionEvaluations() {
this.outcome1 = new ConditionOutcome(false, "m1");
this.outcome2 = new ConditionOutcome(false, "m2");
this.outcome3 = new ConditionOutcome(false, "m3");
@@ -148,14 +148,14 @@ public class ConditionEvaluationReportTests {
}
@Test
public void fullMatch() throws Exception {
public void fullMatch() {
prepareMatches(true, true, true);
assertThat(this.report.getConditionAndOutcomesBySource().get("a").isFullMatch())
.isTrue();
}
@Test
public void notFullMatch() throws Exception {
public void notFullMatch() {
prepareMatches(true, false, true);
assertThat(this.report.getConditionAndOutcomesBySource().get("a").isFullMatch())
.isFalse();
@@ -172,7 +172,7 @@ public class ConditionEvaluationReportTests {
@Test
@SuppressWarnings("resource")
public void springBootConditionPopulatesReport() throws Exception {
public void springBootConditionPopulatesReport() {
ConditionEvaluationReport report = ConditionEvaluationReport.get(
new AnnotationConfigApplicationContext(Config.class).getBeanFactory());
assertThat(report.getConditionAndOutcomesBySource().size()).isNotEqualTo(0);
@@ -225,7 +225,7 @@ public class ConditionEvaluationReportTests {
}
@Test
public void negativeOuterPositiveInnerBean() throws Exception {
public void negativeOuterPositiveInnerBean() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("test.present=true").applyTo(context);
context.register(NegativeOuterConfig.class);

View File

@@ -33,71 +33,70 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ConditionMessageTests {
@Test
public void isEmptyWhenEmptyShouldReturnTrue() throws Exception {
public void isEmptyWhenEmptyShouldReturnTrue() {
ConditionMessage message = ConditionMessage.empty();
assertThat(message.isEmpty()).isTrue();
}
@Test
public void isEmptyWhenNotEmptyShouldReturnFalse() throws Exception {
public void isEmptyWhenNotEmptyShouldReturnFalse() {
ConditionMessage message = ConditionMessage.of("Test");
assertThat(message.isEmpty()).isFalse();
}
@Test
public void toStringWhenEmptyShouldReturnEmptyString() throws Exception {
public void toStringWhenEmptyShouldReturnEmptyString() {
ConditionMessage message = ConditionMessage.empty();
assertThat(message.toString()).isEqualTo("");
}
@Test
public void toStringWhenHasMessageShouldReturnMessage() throws Exception {
public void toStringWhenHasMessageShouldReturnMessage() {
ConditionMessage message = ConditionMessage.of("Test");
assertThat(message.toString()).isEqualTo("Test");
}
@Test
public void appendWhenHasExistingMessageShouldAddSpace() throws Exception {
public void appendWhenHasExistingMessageShouldAddSpace() {
ConditionMessage message = ConditionMessage.of("a").append("b");
assertThat(message.toString()).isEqualTo("a b");
}
@Test
public void appendWhenAppendingNullShouldDoNothing() throws Exception {
public void appendWhenAppendingNullShouldDoNothing() {
ConditionMessage message = ConditionMessage.of("a").append(null);
assertThat(message.toString()).isEqualTo("a");
}
@Test
public void appendWhenNoMessageShouldNotAddSpace() throws Exception {
public void appendWhenNoMessageShouldNotAddSpace() {
ConditionMessage message = ConditionMessage.empty().append("b");
assertThat(message.toString()).isEqualTo("b");
}
@Test
public void andConditionWhenUsingClassShouldIncludeCondition() throws Exception {
public void andConditionWhenUsingClassShouldIncludeCondition() {
ConditionMessage message = ConditionMessage.empty().andCondition(Test.class)
.because("OK");
assertThat(message.toString()).isEqualTo("@Test OK");
}
@Test
public void andConditionWhenUsingStringShouldIncludeCondition() throws Exception {
public void andConditionWhenUsingStringShouldIncludeCondition() {
ConditionMessage message = ConditionMessage.empty().andCondition("@Test")
.because("OK");
assertThat(message.toString()).isEqualTo("@Test OK");
}
@Test
public void andConditionWhenIncludingDetailsShouldIncludeCondition()
throws Exception {
public void andConditionWhenIncludingDetailsShouldIncludeCondition() {
ConditionMessage message = ConditionMessage.empty()
.andCondition(Test.class, "(a=b)").because("OK");
assertThat(message.toString()).isEqualTo("@Test (a=b) OK");
}
@Test
public void ofCollectionShouldCombine() throws Exception {
public void ofCollectionShouldCombine() {
List<ConditionMessage> messages = new ArrayList<>();
messages.add(ConditionMessage.of("a"));
messages.add(ConditionMessage.of("b"));
@@ -106,95 +105,95 @@ public class ConditionMessageTests {
}
@Test
public void ofCollectionWhenNullShouldReturnEmpty() throws Exception {
public void ofCollectionWhenNullShouldReturnEmpty() {
ConditionMessage message = ConditionMessage.of((List<ConditionMessage>) null);
assertThat(message.isEmpty()).isTrue();
}
@Test
public void forConditionShouldIncludeCondition() throws Exception {
public void forConditionShouldIncludeCondition() {
ConditionMessage message = ConditionMessage.forCondition("@Test").because("OK");
assertThat(message.toString()).isEqualTo("@Test OK");
}
@Test
public void forConditionShouldNotAddExtraSpaceWithEmptyCondition() throws Exception {
public void forConditionShouldNotAddExtraSpaceWithEmptyCondition() {
ConditionMessage message = ConditionMessage.forCondition("").because("OK");
assertThat(message.toString()).isEqualTo("OK");
}
@Test
public void forConditionWhenClassShouldIncludeCondition() throws Exception {
public void forConditionWhenClassShouldIncludeCondition() {
ConditionMessage message = ConditionMessage.forCondition(Test.class, "(a=b)")
.because("OK");
assertThat(message.toString()).isEqualTo("@Test (a=b) OK");
}
@Test
public void foundExactlyShouldConstructMessage() throws Exception {
public void foundExactlyShouldConstructMessage() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.foundExactly("abc");
assertThat(message.toString()).isEqualTo("@Test found abc");
}
@Test
public void foundWhenSingleElementShouldUseSingular() throws Exception {
public void foundWhenSingleElementShouldUseSingular() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.found("bean", "beans").items("a");
assertThat(message.toString()).isEqualTo("@Test found bean a");
}
@Test
public void foundNoneAtAllShouldConstructMessage() throws Exception {
public void foundNoneAtAllShouldConstructMessage() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.found("no beans").atAll();
assertThat(message.toString()).isEqualTo("@Test found no beans");
}
@Test
public void foundWhenMultipleElementsShouldUsePlural() throws Exception {
public void foundWhenMultipleElementsShouldUsePlural() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.found("bean", "beans").items("a", "b", "c");
assertThat(message.toString()).isEqualTo("@Test found beans a, b, c");
}
@Test
public void foundWhenQuoteStyleShouldQuote() throws Exception {
public void foundWhenQuoteStyleShouldQuote() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.found("bean", "beans").items(Style.QUOTE, "a", "b", "c");
assertThat(message.toString()).isEqualTo("@Test found beans 'a', 'b', 'c'");
}
@Test
public void didNotFindWhenSingleElementShouldUseSingular() throws Exception {
public void didNotFindWhenSingleElementShouldUseSingular() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.didNotFind("class", "classes").items("a");
assertThat(message.toString()).isEqualTo("@Test did not find class a");
}
@Test
public void didNotFindWhenMultipleElementsShouldUsePlural() throws Exception {
public void didNotFindWhenMultipleElementsShouldUsePlural() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.didNotFind("class", "classes").items("a", "b", "c");
assertThat(message.toString()).isEqualTo("@Test did not find classes a, b, c");
}
@Test
public void resultedInShouldConstructMessage() throws Exception {
public void resultedInShouldConstructMessage() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.resultedIn("Green");
assertThat(message.toString()).isEqualTo("@Test resulted in Green");
}
@Test
public void notAvailableShouldConstructMessage() throws Exception {
public void notAvailableShouldConstructMessage() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.notAvailable("JMX");
assertThat(message.toString()).isEqualTo("@Test JMX is not available");
}
@Test
public void availableShouldConstructMessage() throws Exception {
public void availableShouldConstructMessage() {
ConditionMessage message = ConditionMessage.forCondition(Test.class)
.available("JMX");
assertThat(message.toString()).isEqualTo("@Test JMX is available");

View File

@@ -106,7 +106,7 @@ public class ConditionalOnBeanTests {
}
@Test
public void testOnMissingBeanType() throws Exception {
public void testOnMissingBeanType() {
this.contextRunner
.withUserConfiguration(FooConfiguration.class,
OnBeanMissingClassConfiguration.class)
@@ -114,7 +114,7 @@ public class ConditionalOnBeanTests {
}
@Test
public void withPropertyPlaceholderClassName() throws Exception {
public void withPropertyPlaceholderClassName() {
this.contextRunner
.withUserConfiguration(PropertySourcesPlaceholderConfigurer.class,
WithPropertyPlaceholderClassName.class,
@@ -270,7 +270,7 @@ public class ConditionalOnBeanTests {
public static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
@Override
public ExampleBean getObject() throws Exception {
public ExampleBean getObject() {
return new ExampleBean("fromFactory");
}

View File

@@ -66,7 +66,7 @@ public class ConditionalOnJavaTests {
}
@Test
public void boundsTests() throws Exception {
public void boundsTests() {
testBounds(Range.EQUAL_OR_NEWER, JavaVersion.NINE, JavaVersion.EIGHT, true);
testBounds(Range.EQUAL_OR_NEWER, JavaVersion.EIGHT, JavaVersion.EIGHT, true);
testBounds(Range.EQUAL_OR_NEWER, JavaVersion.EIGHT, JavaVersion.NINE, false);
@@ -76,7 +76,7 @@ public class ConditionalOnJavaTests {
}
@Test
public void equalOrNewerMessage() throws Exception {
public void equalOrNewerMessage() {
ConditionOutcome outcome = this.condition.getMatchOutcome(Range.EQUAL_OR_NEWER,
JavaVersion.NINE, JavaVersion.EIGHT);
assertThat(outcome.getMessage())
@@ -84,7 +84,7 @@ public class ConditionalOnJavaTests {
}
@Test
public void olderThanMessage() throws Exception {
public void olderThanMessage() {
ConditionOutcome outcome = this.condition.getMatchOutcome(Range.OLDER_THAN,
JavaVersion.NINE, JavaVersion.EIGHT);
assertThat(outcome.getMessage())

View File

@@ -92,7 +92,7 @@ public class ConditionalOnMissingBeanTests {
}
@Test
public void hierarchyConsidered() throws Exception {
public void hierarchyConsidered() {
this.context.register(FooConfiguration.class);
this.context.refresh();
AnnotationConfigApplicationContext childContext = new AnnotationConfigApplicationContext();
@@ -103,7 +103,7 @@ public class ConditionalOnMissingBeanTests {
}
@Test
public void hierarchyNotConsidered() throws Exception {
public void hierarchyNotConsidered() {
this.context.register(FooConfiguration.class);
this.context.refresh();
AnnotationConfigApplicationContext childContext = new AnnotationConfigApplicationContext();
@@ -114,7 +114,7 @@ public class ConditionalOnMissingBeanTests {
}
@Test
public void impliedOnBeanMethod() throws Exception {
public void impliedOnBeanMethod() {
this.context.register(ExampleBeanConfiguration.class, ImpliedOnBeanMethod.class);
this.context.refresh();
assertThat(this.context.getBeansOfType(ExampleBean.class).size()).isEqualTo(1);
@@ -610,7 +610,7 @@ public class ConditionalOnMissingBeanTests {
}
@Override
public ExampleBean getObject() throws Exception {
public ExampleBean getObject() {
return new ExampleBean("fromFactory");
}
@@ -633,7 +633,7 @@ public class ConditionalOnMissingBeanTests {
}
@Override
public ExampleBean getObject() throws Exception {
public ExampleBean getObject() {
return new ExampleBean("fromFactory");
}

View File

@@ -98,7 +98,7 @@ public class ConditionalOnPropertyTests {
}
@Test
public void prefixWithoutPeriod() throws Exception {
public void prefixWithoutPeriod() {
load(RelaxedPropertiesRequiredConfigurationWithShortPrefix.class,
"spring.property=value1");
assertThat(this.context.containsBean("foo")).isTrue();
@@ -198,13 +198,13 @@ public class ConditionalOnPropertyTests {
}
@Test
public void usingValueAttribute() throws Exception {
public void usingValueAttribute() {
load(ValueAttribute.class, "some.property");
assertThat(this.context.containsBean("foo")).isTrue();
}
@Test
public void nameOrValueMustBeSpecified() throws Exception {
public void nameOrValueMustBeSpecified() {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectCause(hasMessage(containsString("The name or "
+ "value attribute of @ConditionalOnProperty must be specified")));
@@ -212,7 +212,7 @@ public class ConditionalOnPropertyTests {
}
@Test
public void nameAndValueMustNotBeSpecified() throws Exception {
public void nameAndValueMustNotBeSpecified() {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectCause(hasMessage(containsString("The name and "
+ "value attributes of @ConditionalOnProperty are exclusive")));
@@ -220,14 +220,13 @@ public class ConditionalOnPropertyTests {
}
@Test
public void metaAnnotationConditionMatchesWhenPropertyIsSet() throws Exception {
public void metaAnnotationConditionMatchesWhenPropertyIsSet() {
load(MetaAnnotation.class, "my.feature.enabled=true");
assertThat(this.context.containsBean("foo")).isTrue();
}
@Test
public void metaAnnotationConditionDoesNotMatchWhenPropertyIsNotSet()
throws Exception {
public void metaAnnotationConditionDoesNotMatchWhenPropertyIsNotSet() {
load(MetaAnnotation.class);
assertThat(this.context.containsBean("foo")).isFalse();
}

View File

@@ -35,28 +35,28 @@ import static org.assertj.core.api.Assertions.assertThat;
public class NoneNestedConditionsTests {
@Test
public void neither() throws Exception {
public void neither() {
AnnotationConfigApplicationContext context = load(Config.class);
assertThat(context.containsBean("myBean")).isTrue();
context.close();
}
@Test
public void propertyA() throws Exception {
public void propertyA() {
AnnotationConfigApplicationContext context = load(Config.class, "a:a");
assertThat(context.containsBean("myBean")).isFalse();
context.close();
}
@Test
public void propertyB() throws Exception {
public void propertyB() {
AnnotationConfigApplicationContext context = load(Config.class, "b:b");
assertThat(context.containsBean("myBean")).isFalse();
context.close();
}
@Test
public void both() throws Exception {
public void both() {
AnnotationConfigApplicationContext context = load(Config.class, "a:a", "b:b");
assertThat(context.containsBean("myBean")).isFalse();
context.close();

View File

@@ -48,14 +48,14 @@ public class OnClassConditionAutoConfigurationImportFilterTests {
}
@Test
public void shouldBeRegistered() throws Exception {
public void shouldBeRegistered() {
assertThat(SpringFactoriesLoader
.loadFactories(AutoConfigurationImportFilter.class, null))
.hasAtLeastOneElementOfType(OnClassCondition.class);
}
@Test
public void matchShouldMatchClasses() throws Exception {
public void matchShouldMatchClasses() {
String[] autoConfigurationClasses = new String[] { "test.match", "test.nomatch" };
boolean[] result = this.filter.match(autoConfigurationClasses,
getAutoConfigurationMetadata());
@@ -63,7 +63,7 @@ public class OnClassConditionAutoConfigurationImportFilterTests {
}
@Test
public void matchShouldRecordOutcome() throws Exception {
public void matchShouldRecordOutcome() {
String[] autoConfigurationClasses = new String[] { "test.match", "test.nomatch" };
this.filter.match(autoConfigurationClasses, getAutoConfigurationMetadata());
ConditionEvaluationReport report = ConditionEvaluationReport

View File

@@ -47,7 +47,7 @@ public class SpringBootConditionTests {
}
@Test
public void sensibleMethodException() throws Exception {
public void sensibleMethodException() {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Error processing condition on "
+ ErrorOnMethod.class.getName() + ".myBean");

View File

@@ -47,7 +47,7 @@ public class MessageSourceAutoConfigurationIntegrationTests {
private ApplicationContext context;
@Test
public void testMessageSourceFromPropertySourceAnnotation() throws Exception {
public void testMessageSourceFromPropertySourceAnnotation() {
assertThat(this.context.getMessage("foo", null, "Foo message", Locale.UK))
.isEqualTo("bar");
}

View File

@@ -49,7 +49,7 @@ public class MessageSourceAutoConfigurationProfileTests {
private ApplicationContext context;
@Test
public void testMessageSourceFromPropertySourceAnnotation() throws Exception {
public void testMessageSourceFromPropertySourceAnnotation() {
assertThat(this.context.getMessage("foo", null, "Foo message", Locale.UK))
.isEqualTo("bar");
}

View File

@@ -128,7 +128,7 @@ public class MessageSourceAutoConfigurationTests {
}
@Test
public void testFormatMessageOn() throws Exception {
public void testFormatMessageOn() {
this.contextRunner
.withPropertyValues("spring.messages.basename:test/messages",
"spring.messages.always-use-message-format:true")

View File

@@ -46,7 +46,7 @@ public class PropertyPlaceholderAutoConfigurationTests {
}
@Test
public void propertyPlaceholders() throws Exception {
public void propertyPlaceholders() {
this.context.register(PropertyPlaceholderAutoConfiguration.class,
PlaceholderConfig.class);
TestPropertyValues.of("foo:two").applyTo(this.context);
@@ -56,7 +56,7 @@ public class PropertyPlaceholderAutoConfigurationTests {
}
@Test
public void propertyPlaceholdersOverride() throws Exception {
public void propertyPlaceholdersOverride() {
this.context.register(PropertyPlaceholderAutoConfiguration.class,
PlaceholderConfig.class, PlaceholdersOverride.class);
TestPropertyValues.of("foo:two").applyTo(this.context);

View File

@@ -63,7 +63,7 @@ public class CouchbaseAutoConfigurationIntegrationTests
static class CustomConfiguration {
@Bean
public Cluster myCustomCouchbaseCluster() throws Exception {
public Cluster myCustomCouchbaseCluster() {
return mock(Cluster.class);
}

View File

@@ -152,7 +152,7 @@ public class CouchbaseAutoConfigurationTests
}
@Override
public Cluster couchbaseCluster() throws Exception {
public Cluster couchbaseCluster() {
return mock(Cluster.class);
}

View File

@@ -70,7 +70,7 @@ public class CassandraDataAutoConfigurationTests {
@Test
@SuppressWarnings("unchecked")
public void entityScanShouldSetInitialEntitySet() throws Exception {
public void entityScanShouldSetInitialEntitySet() {
load(EntityScanConfig.class);
CassandraMappingContext mappingContext = this.context
.getBean(CassandraMappingContext.class);
@@ -80,7 +80,7 @@ public class CassandraDataAutoConfigurationTests {
}
@Test
public void userTypeResolverShouldBeSet() throws Exception {
public void userTypeResolverShouldBeSet() {
load();
CassandraMappingContext mappingContext = this.context
.getBean(CassandraMappingContext.class);

View File

@@ -64,7 +64,7 @@ public class CassandraReactiveDataAutoConfigurationTests {
@Test
@SuppressWarnings("unchecked")
public void entityScanShouldSetInitialEntitySet() throws Exception {
public void entityScanShouldSetInitialEntitySet() {
load(EntityScanConfig.class, "spring.data.cassandra.keyspaceName:boot_test");
CassandraMappingContext mappingContext = this.context
.getBean(CassandraMappingContext.class);
@@ -74,7 +74,7 @@ public class CassandraReactiveDataAutoConfigurationTests {
}
@Test
public void userTypeResolverShouldBeSet() throws Exception {
public void userTypeResolverShouldBeSet() {
load("spring.data.cassandra.keyspaceName:boot_test");
CassandraMappingContext mappingContext = this.context
.getBean(CassandraMappingContext.class);

View File

@@ -116,7 +116,7 @@ public class CouchbaseDataAutoConfigurationTests {
@Test
@SuppressWarnings("unchecked")
public void entityScanShouldSetInitialEntitySet() throws Exception {
public void entityScanShouldSetInitialEntitySet() {
load(EntityScanConfig.class);
CouchbaseMappingContext mappingContext = this.context
.getBean(CouchbaseMappingContext.class);

View File

@@ -55,8 +55,7 @@ public class CouchbaseReactiveAndImperativeRepositoriesAutoConfigurationTests {
}
@Test
public void shouldCreateInstancesForReactiveAndImperativeRepositories()
throws Exception {
public void shouldCreateInstancesForReactiveAndImperativeRepositories() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.datasource.initialization-mode:never")
.applyTo(this.context);

View File

@@ -88,7 +88,7 @@ public class CouchbaseReactiveDataAutoConfigurationTests {
@Test
@SuppressWarnings("unchecked")
public void entityScanShouldSetInitialEntitySet() throws Exception {
public void entityScanShouldSetInitialEntitySet() {
load(EntityScanConfig.class);
CouchbaseMappingContext mappingContext = this.context
.getBean(CouchbaseMappingContext.class);

View File

@@ -53,13 +53,13 @@ public class CouchbaseReactiveRepositoriesAutoConfigurationTests {
}
@Test
public void couchbaseNotAvailable() throws Exception {
public void couchbaseNotAvailable() {
load(null);
assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(0);
}
@Test
public void defaultRepository() throws Exception {
public void defaultRepository() {
load(DefaultConfiguration.class);
assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(1);
}
@@ -78,7 +78,7 @@ public class CouchbaseReactiveRepositoriesAutoConfigurationTests {
}
@Test
public void noRepositoryAvailable() throws Exception {
public void noRepositoryAvailable() {
load(NoRepositoryConfiguration.class);
assertThat(this.context.getBeansOfType(ReactiveCityRepository.class)).hasSize(0);
}

View File

@@ -51,13 +51,13 @@ public class CouchbaseRepositoriesAutoConfigurationTests {
}
@Test
public void couchbaseNotAvailable() throws Exception {
public void couchbaseNotAvailable() {
load(null);
assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(0);
}
@Test
public void defaultRepository() throws Exception {
public void defaultRepository() {
load(DefaultConfiguration.class);
assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(1);
}
@@ -76,7 +76,7 @@ public class CouchbaseRepositoriesAutoConfigurationTests {
}
@Test
public void noRepositoryAvailable() throws Exception {
public void noRepositoryAvailable() {
load(NoRepositoryConfiguration.class);
assertThat(this.context.getBeansOfType(CityRepository.class)).hasSize(0);
}

View File

@@ -63,7 +63,7 @@ public class ElasticsearchAutoConfigurationTests {
}
@Test
public void createTransportClient() throws Exception {
public void createTransportClient() {
this.context = new AnnotationConfigApplicationContext();
new ElasticsearchNodeTemplate().doWithNode((node) -> {
TestPropertyValues

View File

@@ -55,7 +55,7 @@ public class ElasticsearchRepositoriesAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
new ElasticsearchNodeTemplate().doWithNode((node) -> {
load(TestConfiguration.class, node);
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
@@ -65,7 +65,7 @@ public class ElasticsearchRepositoriesAutoConfigurationTests {
}
@Test
public void testNoRepositoryConfiguration() throws Exception {
public void testNoRepositoryConfiguration() {
new ElasticsearchNodeTemplate().doWithNode((node) -> {
load(EmptyConfiguration.class, node);
assertThat(this.context.getBean(Client.class)).isNotNull();

View File

@@ -55,7 +55,7 @@ public class JpaRepositoriesAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
prepareApplicationContext(TestConfiguration.class);
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
@@ -64,7 +64,7 @@ public class JpaRepositoriesAutoConfigurationTests {
}
@Test
public void testOverrideRepositoryConfiguration() throws Exception {
public void testOverrideRepositoryConfiguration() {
prepareApplicationContext(CustomConfiguration.class);
assertThat(this.context.getBean(
org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository.class))

View File

@@ -51,7 +51,7 @@ public class JpaWebAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(TestConfiguration.class,

View File

@@ -50,13 +50,13 @@ public class LdapRepositoriesAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
load(TestConfiguration.class);
assertThat(this.context.getBean(PersonRepository.class)).isNotNull();
}
@Test
public void testNoRepositoryConfiguration() throws Exception {
public void testNoRepositoryConfiguration() {
load(EmptyConfiguration.class);
assertThat(this.context.getBeanNamesForType(PersonRepository.class)).isEmpty();
}

View File

@@ -60,7 +60,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.datasource.initialization-mode:never")
.applyTo(this.context);
@@ -70,7 +70,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
}
@Test
public void testMixedRepositoryConfiguration() throws Exception {
public void testMixedRepositoryConfiguration() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.datasource.initialization-mode:never")
.applyTo(this.context);
@@ -81,7 +81,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
}
@Test
public void testJpaRepositoryConfigurationWithMongoTemplate() throws Exception {
public void testJpaRepositoryConfigurationWithMongoTemplate() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.datasource.initialization-mode:never")
.applyTo(this.context);
@@ -91,7 +91,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
}
@Test
public void testJpaRepositoryConfigurationWithMongoOverlap() throws Exception {
public void testJpaRepositoryConfigurationWithMongoOverlap() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.datasource.initialization-mode:never")
.applyTo(this.context);
@@ -101,8 +101,7 @@ public class MixedMongoRepositoriesAutoConfigurationTests {
}
@Test
public void testJpaRepositoryConfigurationWithMongoOverlapDisabled()
throws Exception {
public void testJpaRepositoryConfigurationWithMongoOverlapDisabled() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues
.of("spring.datasource.initialization-mode:never",

View File

@@ -89,7 +89,7 @@ public class MongoDataAutoConfigurationTests {
}
@Test
public void customConversions() throws Exception {
public void customConversions() {
this.context = new AnnotationConfigApplicationContext();
this.context.register(CustomConversionsConfig.class);
this.context.register(PropertyPlaceholderAutoConfiguration.class,
@@ -137,7 +137,7 @@ public class MongoDataAutoConfigurationTests {
@Test
@SuppressWarnings("unchecked")
public void entityScanShouldSetInitialEntitySet() throws Exception {
public void entityScanShouldSetInitialEntitySet() {
this.context = new AnnotationConfigApplicationContext();
this.context.register(EntityScanConfig.class,
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,

View File

@@ -55,8 +55,7 @@ public class MongoReactiveAndBlockingRepositoriesAutoConfigurationTests {
}
@Test
public void shouldCreateInstancesForReactiveAndBlockingRepositories()
throws Exception {
public void shouldCreateInstancesForReactiveAndBlockingRepositories() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.datasource.initialization-mode:never")
.applyTo(this.context);

View File

@@ -57,7 +57,7 @@ public class MongoReactiveRepositoriesAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class));
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
this.runner.withUserConfiguration(TestConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(ReactiveCityRepository.class);
MongoClient client = context.getBean(MongoClient.class);
@@ -72,7 +72,7 @@ public class MongoReactiveRepositoriesAutoConfigurationTests {
}
@Test
public void testNoRepositoryConfiguration() throws Exception {
public void testNoRepositoryConfiguration() {
this.runner.withUserConfiguration(EmptyConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(MongoClient.class));
}

View File

@@ -53,7 +53,7 @@ public class MongoRepositoriesAutoConfigurationTests {
PropertyPlaceholderAutoConfiguration.class));
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
this.runner.withUserConfiguration(TestConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(CityRepository.class);
Mongo mongo = context.getBean(Mongo.class);
@@ -68,7 +68,7 @@ public class MongoRepositoriesAutoConfigurationTests {
}
@Test
public void testNoRepositoryConfiguration() throws Exception {
public void testNoRepositoryConfiguration() {
this.runner.withUserConfiguration(EmptyConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Mongo.class);
assertThat(context.getBean(Mongo.class)).isInstanceOf(MongoClient.class);

View File

@@ -59,34 +59,33 @@ public class MixedNeo4jRepositoriesAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
load(TestConfiguration.class);
assertThat(this.context.getBean(CountryRepository.class)).isNotNull();
}
@Test
public void testMixedRepositoryConfiguration() throws Exception {
public void testMixedRepositoryConfiguration() {
load(MixedConfiguration.class);
assertThat(this.context.getBean(CountryRepository.class)).isNotNull();
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}
@Test
public void testJpaRepositoryConfigurationWithNeo4jTemplate() throws Exception {
public void testJpaRepositoryConfigurationWithNeo4jTemplate() {
load(JpaConfiguration.class);
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}
@Test
@Ignore
public void testJpaRepositoryConfigurationWithNeo4jOverlap() throws Exception {
public void testJpaRepositoryConfigurationWithNeo4jOverlap() {
load(OverlapConfiguration.class);
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}
@Test
public void testJpaRepositoryConfigurationWithNeo4jOverlapDisabled()
throws Exception {
public void testJpaRepositoryConfigurationWithNeo4jOverlapDisabled() {
load(OverlapConfiguration.class, "spring.data.neo4j.repositories.enabled:false");
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
}

View File

@@ -54,7 +54,7 @@ public class Neo4jRepositoriesAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
prepareApplicationContext(TestConfiguration.class);
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
Neo4jMappingContext mappingContext = this.context
@@ -63,7 +63,7 @@ public class Neo4jRepositoriesAutoConfigurationTests {
}
@Test
public void testNoRepositoryConfiguration() throws Exception {
public void testNoRepositoryConfiguration() {
prepareApplicationContext(EmptyConfiguration.class);
assertThat(this.context.getBean(SessionFactory.class)).isNotNull();
}

View File

@@ -55,7 +55,7 @@ public class RedisAutoConfigurationJedisTests {
}
@Test
public void testOverrideRedisConfiguration() throws Exception {
public void testOverrideRedisConfiguration() {
load("spring.redis.host:foo", "spring.redis.database:1");
JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo");
@@ -65,14 +65,14 @@ public class RedisAutoConfigurationJedisTests {
}
@Test
public void testCustomizeRedisConfiguration() throws Exception {
public void testCustomizeRedisConfiguration() {
load(CustomConfiguration.class);
JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class);
assertThat(cf.isUseSsl()).isTrue();
}
@Test
public void testRedisUrlConfiguration() throws Exception {
public void testRedisUrlConfiguration() {
load("spring.redis.host:foo",
"spring.redis.url:redis://user:password@example:33");
JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class);
@@ -83,7 +83,7 @@ public class RedisAutoConfigurationJedisTests {
}
@Test
public void testOverrideUrlRedisConfiguration() throws Exception {
public void testOverrideUrlRedisConfiguration() {
load("spring.redis.host:foo", "spring.redis.password:xyz",
"spring.redis.port:1000", "spring.redis.ssl:false",
"spring.redis.url:rediss://user:password@example:33");
@@ -95,7 +95,7 @@ public class RedisAutoConfigurationJedisTests {
}
@Test
public void testRedisConfigurationWithPool() throws Exception {
public void testRedisConfigurationWithPool() {
load("spring.redis.host:foo", "spring.redis.jedis.pool.min-idle:1",
"spring.redis.jedis.pool.max-idle:4",
"spring.redis.jedis.pool.max-active:16",
@@ -109,7 +109,7 @@ public class RedisAutoConfigurationJedisTests {
}
@Test
public void testRedisConfigurationWithTimeout() throws Exception {
public void testRedisConfigurationWithTimeout() {
load("spring.redis.host:foo", "spring.redis.timeout:100");
JedisConnectionFactory cf = this.context.getBean(JedisConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo");
@@ -117,7 +117,7 @@ public class RedisAutoConfigurationJedisTests {
}
@Test
public void testRedisConfigurationWithSentinel() throws Exception {
public void testRedisConfigurationWithSentinel() {
List<String> sentinels = Arrays.asList("127.0.0.1:26379", "127.0.0.1:26380");
load("spring.redis.sentinel.master:mymaster", "spring.redis.sentinel.nodes:"
+ StringUtils.collectionToCommaDelimitedString(sentinels));
@@ -137,7 +137,7 @@ public class RedisAutoConfigurationJedisTests {
}
@Test
public void testRedisConfigurationWithCluster() throws Exception {
public void testRedisConfigurationWithCluster() {
List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380");
load("spring.redis.cluster.nodes[0]:" + clusterNodes.get(0),
"spring.redis.cluster.nodes[1]:" + clusterNodes.get(1));

View File

@@ -91,7 +91,7 @@ public class RedisAutoConfigurationTests {
}
@Test
public void testRedisUrlConfiguration() throws Exception {
public void testRedisUrlConfiguration() {
load("spring.redis.host:foo",
"spring.redis.url:redis://user:password@example:33");
LettuceConnectionFactory cf = this.context
@@ -116,7 +116,7 @@ public class RedisAutoConfigurationTests {
}
@Test
public void testRedisConfigurationWithPool() throws Exception {
public void testRedisConfigurationWithPool() {
load("spring.redis.host:foo", "spring.redis.lettuce.pool.min-idle:1",
"spring.redis.lettuce.pool.max-idle:4",
"spring.redis.lettuce.pool.max-active:16",
@@ -137,7 +137,7 @@ public class RedisAutoConfigurationTests {
}
@Test
public void testRedisConfigurationWithTimeout() throws Exception {
public void testRedisConfigurationWithTimeout() {
load("spring.redis.host:foo", "spring.redis.timeout:100");
LettuceConnectionFactory cf = this.context
.getBean(LettuceConnectionFactory.class);
@@ -146,7 +146,7 @@ public class RedisAutoConfigurationTests {
}
@Test
public void testRedisConfigurationWithSentinel() throws Exception {
public void testRedisConfigurationWithSentinel() {
List<String> sentinels = Arrays.asList("127.0.0.1:26379", "127.0.0.1:26380");
load("spring.redis.sentinel.master:mymaster", "spring.redis.sentinel.nodes:"
+ StringUtils.collectionToCommaDelimitedString(sentinels));
@@ -155,7 +155,7 @@ public class RedisAutoConfigurationTests {
}
@Test
public void testRedisConfigurationWithSentinelAndPassword() throws Exception {
public void testRedisConfigurationWithSentinelAndPassword() {
load("spring.redis.password=password", "spring.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:127.0.0.1:26379, 127.0.0.1:26380");
LettuceConnectionFactory connectionFactory = this.context
@@ -168,7 +168,7 @@ public class RedisAutoConfigurationTests {
}
@Test
public void testRedisConfigurationWithCluster() throws Exception {
public void testRedisConfigurationWithCluster() {
List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380");
load("spring.redis.cluster.nodes[0]:" + clusterNodes.get(0),
"spring.redis.cluster.nodes[1]:" + clusterNodes.get(1));
@@ -177,7 +177,7 @@ public class RedisAutoConfigurationTests {
}
@Test
public void testRedisConfigurationWithClusterAndPassword() throws Exception {
public void testRedisConfigurationWithClusterAndPassword() {
List<String> clusterNodes = Arrays.asList("127.0.0.1:27379", "127.0.0.1:27380");
load("spring.redis.password=password",
"spring.redis.cluster.nodes[0]:" + clusterNodes.get(0),

View File

@@ -69,14 +69,14 @@ public class RepositoryRestMvcAutoConfigurationTests {
}
@Test
public void testDefaultRepositoryConfiguration() throws Exception {
public void testDefaultRepositoryConfiguration() {
load(TestConfiguration.class);
assertThat(this.context.getBean(RepositoryRestMvcConfiguration.class))
.isNotNull();
}
@Test
public void testWithCustomBasePath() throws Exception {
public void testWithCustomBasePath() {
load(TestConfiguration.class, "spring.data.rest.base-path:foo");
assertThat(this.context.getBean(RepositoryRestMvcConfiguration.class))
.isNotNull();
@@ -91,7 +91,7 @@ public class RepositoryRestMvcAutoConfigurationTests {
}
@Test
public void testWithCustomSettings() throws Exception {
public void testWithCustomSettings() {
load(TestConfiguration.class, "spring.data.rest.default-page-size:42",
"spring.data.rest.max-page-size:78",
"spring.data.rest.page-param-name:_page",

View File

@@ -84,7 +84,7 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
}
@Test
public void failureAnalysisForMissingCollectionType() throws Exception {
public void failureAnalysisForMissingCollectionType() {
FailureAnalysis analysis = analyzeFailure(
createFailure(StringCollectionConfiguration.class));
assertDescriptionConstructorMissingType(analysis, StringCollectionHandler.class,
@@ -96,7 +96,7 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
}
@Test
public void failureAnalysisForMissingMapType() throws Exception {
public void failureAnalysisForMissingMapType() {
FailureAnalysis analysis = analyzeFailure(
createFailure(StringMapConfiguration.class));
assertDescriptionConstructorMissingType(analysis, StringMapHandler.class, 0,

View File

@@ -51,7 +51,7 @@ public class EntityScanPackagesTests {
}
@Test
public void getWhenNoneRegisteredShouldReturnNone() throws Exception {
public void getWhenNoneRegisteredShouldReturnNone() {
this.context = new AnnotationConfigApplicationContext();
this.context.refresh();
EntityScanPackages packages = EntityScanPackages.get(this.context);
@@ -60,7 +60,7 @@ public class EntityScanPackagesTests {
}
@Test
public void getShouldReturnRegisterPackages() throws Exception {
public void getShouldReturnRegisterPackages() {
this.context = new AnnotationConfigApplicationContext();
EntityScanPackages.register(this.context, "a", "b");
EntityScanPackages.register(this.context, "b", "c");
@@ -70,8 +70,7 @@ public class EntityScanPackagesTests {
}
@Test
public void registerFromArrayWhenRegistryIsNullShouldThrowException()
throws Exception {
public void registerFromArrayWhenRegistryIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Registry must not be null");
EntityScanPackages.register(null);
@@ -79,8 +78,7 @@ public class EntityScanPackagesTests {
}
@Test
public void registerFromArrayWhenPackageNamesIsNullShouldThrowException()
throws Exception {
public void registerFromArrayWhenPackageNamesIsNullShouldThrowException() {
this.context = new AnnotationConfigApplicationContext();
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("PackageNames must not be null");
@@ -88,16 +86,14 @@ public class EntityScanPackagesTests {
}
@Test
public void registerFromCollectionWhenRegistryIsNullShouldThrowException()
throws Exception {
public void registerFromCollectionWhenRegistryIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Registry must not be null");
EntityScanPackages.register(null, Collections.emptyList());
}
@Test
public void registerFromCollectionWhenPackageNamesIsNullShouldThrowException()
throws Exception {
public void registerFromCollectionWhenPackageNamesIsNullShouldThrowException() {
this.context = new AnnotationConfigApplicationContext();
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("PackageNames must not be null");
@@ -105,8 +101,7 @@ public class EntityScanPackagesTests {
}
@Test
public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackages()
throws Exception {
public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackages() {
this.context = new AnnotationConfigApplicationContext(
EntityScanValueConfig.class);
EntityScanPackages packages = EntityScanPackages.get(this.context);
@@ -114,8 +109,7 @@ public class EntityScanPackagesTests {
}
@Test
public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackagesAsm()
throws Exception {
public void entityScanAnnotationWhenHasValueAttributeShouldSetupPackagesAsm() {
this.context = new AnnotationConfigApplicationContext();
this.context.registerBeanDefinition("entityScanValueConfig",
new RootBeanDefinition(EntityScanValueConfig.class.getName()));
@@ -125,8 +119,7 @@ public class EntityScanPackagesTests {
}
@Test
public void entityScanAnnotationWhenHasBasePackagesAttributeShouldSetupPackages()
throws Exception {
public void entityScanAnnotationWhenHasBasePackagesAttributeShouldSetupPackages() {
this.context = new AnnotationConfigApplicationContext(
EntityScanBasePackagesConfig.class);
EntityScanPackages packages = EntityScanPackages.get(this.context);
@@ -134,16 +127,14 @@ public class EntityScanPackagesTests {
}
@Test
public void entityScanAnnotationWhenHasValueAndBasePackagesAttributeShouldThrow()
throws Exception {
public void entityScanAnnotationWhenHasValueAndBasePackagesAttributeShouldThrow() {
this.thrown.expect(AnnotationConfigurationException.class);
this.context = new AnnotationConfigApplicationContext(
EntityScanValueAndBasePackagesConfig.class);
}
@Test
public void entityScanAnnotationWhenHasBasePackageClassesAttributeShouldSetupPackages()
throws Exception {
public void entityScanAnnotationWhenHasBasePackageClassesAttributeShouldSetupPackages() {
this.context = new AnnotationConfigApplicationContext(
EntityScanBasePackageClassesConfig.class);
EntityScanPackages packages = EntityScanPackages.get(this.context);
@@ -152,8 +143,7 @@ public class EntityScanPackagesTests {
}
@Test
public void entityScanAnnotationWhenNoAttributesShouldSetupPackages()
throws Exception {
public void entityScanAnnotationWhenNoAttributesShouldSetupPackages() {
this.context = new AnnotationConfigApplicationContext(
EntityScanNoAttributesConfig.class);
EntityScanPackages packages = EntityScanPackages.get(this.context);
@@ -162,8 +152,7 @@ public class EntityScanPackagesTests {
}
@Test
public void entityScanAnnotationWhenLoadingFromMultipleConfigsShouldCombinePackages()
throws Exception {
public void entityScanAnnotationWhenLoadingFromMultipleConfigsShouldCombinePackages() {
this.context = new AnnotationConfigApplicationContext(EntityScanValueConfig.class,
EntityScanBasePackagesConfig.class);
EntityScanPackages packages = EntityScanPackages.get(this.context);

View File

@@ -47,7 +47,7 @@ public class EntityScannerTests {
public ExpectedException thrown = ExpectedException.none();
@Test
public void createWhenContextIsNullShouldThrowException() throws Exception {
public void createWhenContextIsNullShouldThrowException() {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Context must not be null");
new EntityScanner(null);

View File

@@ -116,7 +116,7 @@ public class JestAutoConfigurationTests {
}
@Test
public void jestCanCommunicateWithElasticsearchInstance() throws IOException {
public void jestCanCommunicateWithElasticsearchInstance() {
new ElasticsearchNodeTemplate().doWithNode((node) -> {
load("spring.elasticsearch.jest.uris=http://localhost:" + node.getHttpPort());
JestClient client = this.context.getBean(JestClient.class);

View File

@@ -207,7 +207,7 @@ public class FlywayAutoConfigurationTests {
}
@Test
public void customFlywayMigrationInitializer() throws Exception {
public void customFlywayMigrationInitializer() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class,
CustomFlywayMigrationInitializer.class).run((context) -> {
assertThat(context).hasSingleBean(Flyway.class);

View File

@@ -124,7 +124,7 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
return "Hello World";
}
private MockServerWebExchange render(String viewName) throws Exception {
private MockServerWebExchange render(String viewName) {
FreeMarkerViewResolver resolver = this.context
.getBean(FreeMarkerViewResolver.class);
Mono<View> view = resolver.resolveViewName(viewName, Locale.UK);

View File

@@ -151,15 +151,14 @@ public class FreeMarkerAutoConfigurationServletIntegrationTests {
}
@Test
public void registerResourceHandlingFilterDisabledByDefault() throws Exception {
public void registerResourceHandlingFilterDisabledByDefault() {
registerAndRefreshContext();
assertThat(this.context.getBeansOfType(ResourceUrlEncodingFilter.class))
.isEmpty();
}
@Test
public void registerResourceHandlingFilterOnlyIfResourceChainIsEnabled()
throws Exception {
public void registerResourceHandlingFilterOnlyIfResourceChainIsEnabled() {
registerAndRefreshContext("spring.resources.chain.enabled:true");
assertThat(this.context.getBean(ResourceUrlEncodingFilter.class)).isNotNull();
}

View File

@@ -66,7 +66,7 @@ public class FreeMarkerAutoConfigurationTests {
}
@Test
public void nonExistentTemplateLocation() throws Exception {
public void nonExistentTemplateLocation() {
registerAndRefreshContext("spring.freemarker.templateLoaderPath:"
+ "classpath:/does-not-exist/,classpath:/also-does-not-exist");
this.output.expect(containsString("Cannot find template location"));

View File

@@ -100,7 +100,7 @@ public class GroovyTemplateAutoConfigurationTests {
}
@Test
public void disableViewResolution() throws Exception {
public void disableViewResolution() {
TestPropertyValues.of("spring.groovy.template.enabled:false")
.applyTo(this.context);
registerAndRefreshContext();
@@ -171,7 +171,7 @@ public class GroovyTemplateAutoConfigurationTests {
}
@Test
public void customConfiguration() throws Exception {
public void customConfiguration() {
registerAndRefreshContext(
"spring.groovy.template.configuration.auto-indent:true");
assertThat(this.context.getBean(GroovyMarkupConfigurer.class).isAutoIndent())

View File

@@ -62,7 +62,7 @@ public class HypermediaAutoConfigurationTests {
}
@Test
public void linkDiscoverersCreated() throws Exception {
public void linkDiscoverersCreated() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(BaseConfig.class);
@@ -74,7 +74,7 @@ public class HypermediaAutoConfigurationTests {
}
@Test
public void entityLinksCreated() throws Exception {
public void entityLinksCreated() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(BaseConfig.class);

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.hazelcast;
import java.io.IOException;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.impl.HazelcastClientProxy;
import com.hazelcast.config.Config;
@@ -65,7 +63,7 @@ public class HazelcastAutoConfigurationClientTests {
.withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class));
@Test
public void systemProperty() throws IOException {
public void systemProperty() {
this.contextRunner
.withSystemProperties(HazelcastClientConfiguration.CONFIG_SYSTEM_PROPERTY
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/"
@@ -76,7 +74,7 @@ public class HazelcastAutoConfigurationClientTests {
}
@Test
public void explicitConfigFile() throws IOException {
public void explicitConfigFile() {
this.contextRunner
.withPropertyValues(
"spring.hazelcast.config=org/springframework/boot/autoconfigure/"
@@ -87,7 +85,7 @@ public class HazelcastAutoConfigurationClientTests {
}
@Test
public void explicitConfigUrl() throws IOException {
public void explicitConfigUrl() {
this.contextRunner
.withPropertyValues(
"spring.hazelcast.config=hazelcast-client-default.xml")

View File

@@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.hazelcast;
import java.io.IOException;
import java.util.Map;
import com.hazelcast.config.Config;
@@ -50,7 +49,7 @@ public class HazelcastAutoConfigurationServerTests {
.withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class));
@Test
public void defaultConfigFile() throws IOException {
public void defaultConfigFile() {
// hazelcast.xml present in root classpath
this.contextRunner.run((context) -> {
Config config = context.getBean(HazelcastInstance.class).getConfig();
@@ -60,7 +59,7 @@ public class HazelcastAutoConfigurationServerTests {
}
@Test
public void systemProperty() throws IOException {
public void systemProperty() {
this.contextRunner
.withSystemProperties(HazelcastServerConfiguration.CONFIG_SYSTEM_PROPERTY
+ "=classpath:org/springframework/boot/autoconfigure/hazelcast/hazelcast-specific.xml")
@@ -71,7 +70,7 @@ public class HazelcastAutoConfigurationServerTests {
}
@Test
public void explicitConfigFile() throws IOException {
public void explicitConfigFile() {
this.contextRunner.withPropertyValues(
"spring.hazelcast.config=org/springframework/boot/autoconfigure/hazelcast/"
+ "hazelcast-specific.xml")
@@ -85,7 +84,7 @@ public class HazelcastAutoConfigurationServerTests {
}
@Test
public void explicitConfigUrl() throws IOException {
public void explicitConfigUrl() {
this.contextRunner
.withPropertyValues("spring.hazelcast.config=hazelcast-default.xml")
.run((context) -> {

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.hazelcast;
import java.io.IOException;
import com.hazelcast.config.Config;
import com.hazelcast.core.HazelcastInstance;
import org.junit.Test;
@@ -39,7 +37,7 @@ public class HazelcastAutoConfigurationTests {
.withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class));
@Test
public void defaultConfigFile() throws IOException {
public void defaultConfigFile() {
// no hazelcast-client.xml and hazelcast.xml is present in root classpath
this.contextRunner.run((context) -> {
Config config = context.getBean(HazelcastInstance.class).getConfig();

View File

@@ -46,8 +46,7 @@ public class HttpMessageConvertersAutoConfigurationWithoutJacksonTests {
}
@Test
public void autoConfigurationWorksWithSpringHateoasButWithoutJackson()
throws Exception {
public void autoConfigurationWorksWithSpringHateoasButWithoutJackson() {
this.context.register(HttpMessageConvertersAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBeansOfType(HttpMessageConverters.class)).hasSize(1);

View File

@@ -47,7 +47,7 @@ import static org.mockito.Mockito.mock;
public class HttpMessageConvertersTests {
@Test
public void containsDefaults() throws Exception {
public void containsDefaults() {
HttpMessageConverters converters = new HttpMessageConverters();
List<Class<?>> converterClasses = new ArrayList<>();
for (HttpMessageConverter<?> converter : converters) {
@@ -108,7 +108,7 @@ public class HttpMessageConvertersTests {
}
@Test
public void postProcessConverters() throws Exception {
public void postProcessConverters() {
HttpMessageConverters converters = new HttpMessageConverters() {
@Override
@@ -135,7 +135,7 @@ public class HttpMessageConvertersTests {
}
@Test
public void postProcessPartConverters() throws Exception {
public void postProcessPartConverters() {
HttpMessageConverters converters = new HttpMessageConverters() {
@Override

View File

@@ -118,7 +118,7 @@ public class JacksonAutoConfigurationTests {
*/
@Test
public void noCustomDateFormat() throws Exception {
public void noCustomDateFormat() {
this.context.register(JacksonAutoConfiguration.class);
this.context.refresh();
ObjectMapper mapper = this.context.getBean(ObjectMapper.class);
@@ -126,7 +126,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void customDateFormat() throws Exception {
public void customDateFormat() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.date-format:yyyyMMddHHmmss")
.applyTo(this.context);
@@ -155,7 +155,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void customDateFormatClass() throws Exception {
public void customDateFormatClass() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues
.of("spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat")
@@ -166,7 +166,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void noCustomPropertyNamingStrategy() throws Exception {
public void noCustomPropertyNamingStrategy() {
this.context.register(JacksonAutoConfiguration.class);
this.context.refresh();
ObjectMapper mapper = this.context.getBean(ObjectMapper.class);
@@ -174,7 +174,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void customPropertyNamingStrategyField() throws Exception {
public void customPropertyNamingStrategyField() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.property-naming-strategy:SNAKE_CASE")
.applyTo(this.context);
@@ -185,7 +185,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void customPropertyNamingStrategyClass() throws Exception {
public void customPropertyNamingStrategyClass() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues
.of("spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy")
@@ -197,7 +197,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void enableSerializationFeature() throws Exception {
public void enableSerializationFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.serialization.indent_output:true")
.applyTo(this.context);
@@ -210,7 +210,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void disableSerializationFeature() throws Exception {
public void disableSerializationFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues
.of("spring.jackson.serialization.write_dates_as_timestamps:false")
@@ -224,7 +224,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void enableDeserializationFeature() throws Exception {
public void enableDeserializationFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues
.of("spring.jackson.deserialization.use_big_decimal_for_floats:true")
@@ -238,7 +238,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void disableDeserializationFeature() throws Exception {
public void disableDeserializationFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues
.of("spring.jackson.deserialization.fail-on-unknown-properties:false")
@@ -252,7 +252,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void enableMapperFeature() throws Exception {
public void enableMapperFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.mapper.require_setters_for_getters:true")
.applyTo(this.context);
@@ -269,7 +269,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void disableMapperFeature() throws Exception {
public void disableMapperFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.mapper.use_annotations:false")
.applyTo(this.context);
@@ -283,7 +283,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void enableParserFeature() throws Exception {
public void enableParserFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.parser.allow_single_quotes:true")
.applyTo(this.context);
@@ -295,7 +295,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void disableParserFeature() throws Exception {
public void disableParserFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.parser.auto_close_source:false")
.applyTo(this.context);
@@ -307,7 +307,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void enableGeneratorFeature() throws Exception {
public void enableGeneratorFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.generator.write_numbers_as_strings:true")
.applyTo(this.context);
@@ -320,7 +320,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void disableGeneratorFeature() throws Exception {
public void disableGeneratorFeature() {
this.context.register(JacksonAutoConfiguration.class);
TestPropertyValues.of("spring.jackson.generator.auto_close_target:false")
.applyTo(this.context);
@@ -332,7 +332,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void defaultObjectMapperBuilder() throws Exception {
public void defaultObjectMapperBuilder() {
this.context.register(JacksonAutoConfiguration.class);
this.context.refresh();
Jackson2ObjectMapperBuilder builder = this.context
@@ -430,7 +430,7 @@ public class JacksonAutoConfigurationTests {
}
@Test
public void additionalJacksonBuilderCustomization() throws Exception {
public void additionalJacksonBuilderCustomization() {
this.context.register(JacksonAutoConfiguration.class,
ObjectMapperBuilderCustomConfig.class);
this.context.refresh();
@@ -594,7 +594,7 @@ public class JacksonAutoConfigurationTests {
@Override
protected void serializeObject(Baz value, JsonGenerator jgen,
SerializerProvider provider) throws IOException {
SerializerProvider provider) {
}
}

View File

@@ -21,8 +21,6 @@ import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -68,13 +66,13 @@ public class DataSourceAutoConfigurationTests {
+ new Random().nextInt());
@Test
public void testDefaultDataSourceExists() throws Exception {
public void testDefaultDataSourceExists() {
this.contextRunner
.run((context) -> assertThat(context).hasSingleBean(DataSource.class));
}
@Test
public void testDataSourceHasEmbeddedDefault() throws Exception {
public void testDataSourceHasEmbeddedDefault() {
this.contextRunner.run((context) -> {
HikariDataSource dataSource = context.getBean(HikariDataSource.class);
assertThat(dataSource.getJdbcUrl()).isNotNull();
@@ -83,7 +81,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void testBadUrl() throws Exception {
public void testBadUrl() {
this.contextRunner
.withPropertyValues("spring.datasource.url:jdbc:not-going-to-work")
.withClassLoader(new DisableEmbeddedDatabaseClassLoader())
@@ -92,7 +90,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void testBadDriverClass() throws Exception {
public void testBadDriverClass() {
this.contextRunner
.withPropertyValues(
"spring.datasource.driverClassName:org.none.jdbcDriver")
@@ -102,7 +100,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void hikariValidatesConnectionByDefault() throws Exception {
public void hikariValidatesConnectionByDefault() {
assertDataSource(HikariDataSource.class,
Collections.singletonList("org.apache.tomcat"), (dataSource) ->
// Use Connection#isValid()
@@ -110,7 +108,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void tomcatIsFallback() throws Exception {
public void tomcatIsFallback() {
assertDataSource(org.apache.tomcat.jdbc.pool.DataSource.class,
Collections.singletonList("com.zaxxer.hikari"),
(dataSource) -> assertThat(dataSource.getUrl())
@@ -128,7 +126,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void commonsDbcp2IsFallback() throws Exception {
public void commonsDbcp2IsFallback() {
assertDataSource(BasicDataSource.class,
Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat"),
(dataSource) -> assertThat(dataSource.getUrl())
@@ -136,7 +134,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void commonsDbcp2ValidatesConnectionByDefault() throws Exception {
public void commonsDbcp2ValidatesConnectionByDefault() {
assertDataSource(org.apache.commons.dbcp2.BasicDataSource.class,
Arrays.asList("com.zaxxer.hikari", "org.apache.tomcat"), (dataSource) -> {
assertThat(dataSource.getTestOnBorrow()).isEqualTo(true);
@@ -147,7 +145,7 @@ public class DataSourceAutoConfigurationTests {
@Test
@SuppressWarnings("resource")
public void testEmbeddedTypeDefaultsUsername() throws Exception {
public void testEmbeddedTypeDefaultsUsername() {
this.contextRunner.withPropertyValues(
"spring.datasource.driverClassName:org.hsqldb.jdbcDriver",
"spring.datasource.url:jdbc:hsqldb:mem:testdb").run((context) -> {
@@ -196,7 +194,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void testExplicitDriverClassClearsUsername() throws Exception {
public void testExplicitDriverClassClearsUsername() {
this.contextRunner.withPropertyValues(
"spring.datasource.driverClassName:" + DatabaseTestDriver.class.getName(),
"spring.datasource.url:jdbc:foo://localhost").run((context) -> {
@@ -209,7 +207,7 @@ public class DataSourceAutoConfigurationTests {
}
@Test
public void testDefaultDataSourceCanBeOverridden() throws Exception {
public void testDefaultDataSourceCanBeOverridden() {
this.contextRunner.withUserConfiguration(TestDataSourceConfiguration.class)
.run((context) -> assertThat(context).getBean(DataSource.class)
.isInstanceOf(BasicDataSource.class));
@@ -272,18 +270,17 @@ public class DataSourceAutoConfigurationTests {
public static class DatabaseTestDriver implements Driver {
@Override
public Connection connect(String url, Properties info) throws SQLException {
public Connection connect(String url, Properties info) {
return mock(Connection.class);
}
@Override
public boolean acceptsURL(String url) throws SQLException {
public boolean acceptsURL(String url) {
return true;
}
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException {
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
return new DriverPropertyInfo[0];
}
@@ -303,7 +300,7 @@ public class DataSourceAutoConfigurationTests {
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
public Logger getParentLogger() {
return mock(Logger.class);
}

View File

@@ -44,7 +44,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests {
private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@Test
public void testDataSourceExists() throws Exception {
public void testDataSourceExists() {
this.context.register(EmbeddedDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class,
TransactionAutoConfiguration.class);
@@ -54,7 +54,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests {
}
@Test
public void testNoDataSourceExists() throws Exception {
public void testNoDataSourceExists() {
this.context.register(DataSourceTransactionManagerAutoConfiguration.class,
TransactionAutoConfiguration.class);
this.context.refresh();
@@ -64,7 +64,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests {
}
@Test
public void testManualConfiguration() throws Exception {
public void testManualConfiguration() {
this.context.register(EmbeddedDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class,
TransactionAutoConfiguration.class);
@@ -87,7 +87,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests {
}
@Test
public void testMultiDataSource() throws Exception {
public void testMultiDataSource() {
this.context.register(MultiDataSourceConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class,
TransactionAutoConfiguration.class);
@@ -97,7 +97,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests {
}
@Test
public void testMultiDataSourceUsingPrimary() throws Exception {
public void testMultiDataSourceUsingPrimary() {
this.context.register(MultiDataSourceUsingPrimaryConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class,
TransactionAutoConfiguration.class);
@@ -108,8 +108,7 @@ public class DataSourceTransactionManagerAutoConfigurationTests {
}
@Test
public void testCustomizeDataSourceTransactionManagerUsingProperties()
throws Exception {
public void testCustomizeDataSourceTransactionManagerUsingProperties() {
TestPropertyValues
.of("spring.transaction.default-timeout:30",
"spring.transaction.rollback-on-commit-failure:true")

View File

@@ -48,14 +48,14 @@ public class HikariDataSourceConfigurationTests {
}
@Test
public void testDataSourceExists() throws Exception {
public void testDataSourceExists() {
load();
assertThat(this.context.getBeansOfType(DataSource.class)).hasSize(1);
assertThat(this.context.getBeansOfType(HikariDataSource.class)).hasSize(1);
}
@Test
public void testDataSourcePropertiesOverridden() throws Exception {
public void testDataSourcePropertiesOverridden() {
load("spring.datasource.hikari.jdbc-url=jdbc:foo//bar/spam",
"spring.datasource.hikari.max-lifetime=1234");
HikariDataSource ds = this.context.getBean(HikariDataSource.class);
@@ -65,7 +65,7 @@ public class HikariDataSourceConfigurationTests {
}
@Test
public void testDataSourceGenericPropertiesOverridden() throws Exception {
public void testDataSourceGenericPropertiesOverridden() {
load("spring.datasource.hikari.data-source-properties.dataSourceClassName=org.h2.JDBCDataSource");
HikariDataSource ds = this.context.getBean(HikariDataSource.class);
assertThat(ds.getDataSourceProperties().getProperty("dataSourceClassName"))
@@ -73,7 +73,7 @@ public class HikariDataSourceConfigurationTests {
}
@Test
public void testDataSourceDefaultsPreserved() throws Exception {
public void testDataSourceDefaultsPreserved() {
load();
HikariDataSource ds = this.context.getBean(HikariDataSource.class);
assertThat(ds.getMaxLifetime()).isEqualTo(1800000);

View File

@@ -68,7 +68,7 @@ public class JdbcTemplateAutoConfigurationTests {
}
@Test
public void testJdbcTemplateWithCustomProperties() throws Exception {
public void testJdbcTemplateWithCustomProperties() {
load("spring.jdbc.template.fetch-size:100",
"spring.jdbc.template.query-timeout:60",
"spring.jdbc.template.max-rows:1000");

View File

@@ -157,7 +157,7 @@ public class JndiDataSourceAutoConfigurationTests {
}
private void configureJndi(String name, DataSource dataSource)
throws IllegalStateException, NamingException {
throws IllegalStateException {
TestableInitialContextFactory.bind(name, dataSource);
}

View File

@@ -57,7 +57,7 @@ public class TomcatDataSourceConfigurationTests {
}
@Test
public void testDataSourceExists() throws Exception {
public void testDataSourceExists() {
this.context.register(TomcatDataSourceConfiguration.class);
TestPropertyValues.of(PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context);
this.context.refresh();
@@ -103,7 +103,7 @@ public class TomcatDataSourceConfigurationTests {
}
@Test
public void testDataSourceDefaultsPreserved() throws Exception {
public void testDataSourceDefaultsPreserved() {
this.context.register(TomcatDataSourceConfiguration.class);
TestPropertyValues.of(PREFIX + "url:jdbc:h2:mem:testdb").applyTo(this.context);
this.context.refresh();

View File

@@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock;
public class XADataSourceAutoConfigurationTests {
@Test
public void wrapExistingXaDataSource() throws Exception {
public void wrapExistingXaDataSource() {
ApplicationContext context = createContext(WrapExisting.class);
context.getBean(DataSource.class);
XADataSource source = context.getBean(XADataSource.class);
@@ -49,7 +49,7 @@ public class XADataSourceAutoConfigurationTests {
}
@Test
public void createFromUrl() throws Exception {
public void createFromUrl() {
ApplicationContext context = createContext(FromProperties.class,
"spring.datasource.url:jdbc:hsqldb:mem:test",
"spring.datasource.username:un");

View File

@@ -412,7 +412,7 @@ public class JmsAutoConfigurationTests {
}
@Test
public void enableJmsAutomatically() throws Exception {
public void enableJmsAutomatically() {
this.contextRunner.withUserConfiguration(NoEnableJmsConfiguration.class)
.run((context) -> assertThat(context)
.hasBean(

View File

@@ -17,7 +17,6 @@
package org.springframework.boot.autoconfigure.jms.activemq;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.pool.PooledConnectionFactory;
@@ -199,7 +198,7 @@ public class ActiveMQAutoConfigurationTests {
}
@Test
public void pooledConnectionFactoryConfiguration() throws JMSException {
public void pooledConnectionFactoryConfiguration() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
.withPropertyValues("spring.activemq.pool.enabled:true")
.run((context) -> {

View File

@@ -221,7 +221,7 @@ public class ArtemisAutoConfigurationTests {
}
@Test
public void embeddedWithPersistentMode() throws IOException, JMSException {
public void embeddedWithPersistentMode() throws IOException {
File dataFolder = this.folder.newFolder();
final String messageId = UUID.randomUUID().toString();
// Start the server and post a message to some queue

View File

@@ -52,7 +52,7 @@ public class ArtemisEmbeddedConfigurationFactoryTests {
}
@Test
public void generatedClusterPassword() throws Exception {
public void generatedClusterPassword() {
ArtemisProperties properties = new ArtemisProperties();
Configuration configuration = new ArtemisEmbeddedConfigurationFactory(properties)
.createConfiguration();
@@ -60,7 +60,7 @@ public class ArtemisEmbeddedConfigurationFactoryTests {
}
@Test
public void specificClusterPassword() throws Exception {
public void specificClusterPassword() {
ArtemisProperties properties = new ArtemisProperties();
properties.getEmbedded().setClusterPassword("password");
Configuration configuration = new ArtemisEmbeddedConfigurationFactory(properties)

View File

@@ -117,7 +117,7 @@ public class JmxAutoConfigurationTests {
}
@Test
public void testParentContext() throws Exception {
public void testParentContext() {
this.context = new AnnotationConfigApplicationContext();
this.context.register(JmxAutoConfiguration.class, TestConfiguration.class);
this.context.refresh();

View File

@@ -74,14 +74,14 @@ public class JooqAutoConfigurationTests {
}
@Test
public void noDataSource() throws Exception {
public void noDataSource() {
load();
assertThat(this.context.getBeanNamesForType(DSLContext.class).length)
.isEqualTo(0);
}
@Test
public void jooqWithoutTx() throws Exception {
public void jooqWithoutTx() {
load(JooqDataSourceConfiguration.class);
assertThat(getBeanNames(PlatformTransactionManager.class)).isEqualTo(NO_BEANS);
assertThat(getBeanNames(SpringTransactionProvider.class)).isEqualTo(NO_BEANS);
@@ -107,7 +107,7 @@ public class JooqAutoConfigurationTests {
}
@Test
public void jooqWithTx() throws Exception {
public void jooqWithTx() {
load(JooqDataSourceConfiguration.class, TxManagerConfiguration.class);
this.context.getBean(PlatformTransactionManager.class);
DSLContext dsl = this.context.getBean(DSLContext.class);
@@ -188,7 +188,7 @@ public class JooqAutoConfigurationTests {
}
@Override
public void run(org.jooq.Configuration configuration) throws Exception {
public void run(org.jooq.Configuration configuration) {
assertThat(this.dsl.fetch(this.sql).getValue(0, 0).toString())
.isEqualTo(this.expected);
}
@@ -207,7 +207,7 @@ public class JooqAutoConfigurationTests {
}
@Override
public void run(org.jooq.Configuration configuration) throws Exception {
public void run(org.jooq.Configuration configuration) {
for (String statement : this.sql) {
this.dsl.execute(statement);
}

View File

@@ -37,7 +37,7 @@ import static org.mockito.Mockito.mock;
public class SqlDialectLookupTests {
@Test
public void getSqlDialectWhenDataSourceIsNullShouldReturnDefault() throws Exception {
public void getSqlDialectWhenDataSourceIsNullShouldReturnDefault() {
assertThat(SqlDialectLookup.getDialect(null)).isEqualTo(SQLDialect.DEFAULT);
}

View File

@@ -59,7 +59,7 @@ public class EmbeddedLdapAutoConfigurationTests {
}
@Test
public void testSetDefaultPort() throws LDAPException {
public void testSetDefaultPort() {
load("spring.ldap.embedded.port:1234",
"spring.ldap.embedded.base-dn:dc=spring,dc=org");
InMemoryDirectoryServer server = this.context
@@ -68,7 +68,7 @@ public class EmbeddedLdapAutoConfigurationTests {
}
@Test
public void testRandomPortWithEnvironment() throws LDAPException {
public void testRandomPortWithEnvironment() {
load("spring.ldap.embedded.base-dn:dc=spring,dc=org");
InMemoryDirectoryServer server = this.context
.getBean(InMemoryDirectoryServer.class);
@@ -77,7 +77,7 @@ public class EmbeddedLdapAutoConfigurationTests {
}
@Test
public void testRandomPortWithValueAnnotation() throws LDAPException {
public void testRandomPortWithValueAnnotation() {
TestPropertyValues.of("spring.ldap.embedded.base-dn:dc=spring,dc=org")
.applyTo(this.context);
this.context.register(EmbeddedLdapAutoConfiguration.class,
@@ -118,7 +118,7 @@ public class EmbeddedLdapAutoConfigurationTests {
}
@Test
public void testQueryEmbeddedLdap() throws LDAPException {
public void testQueryEmbeddedLdap() {
TestPropertyValues.of("spring.ldap.embedded.base-dn:dc=spring,dc=org")
.applyTo(this.context);
this.context.register(EmbeddedLdapAutoConfiguration.class,

View File

@@ -105,7 +105,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
}
@Test
public void logsOutput() throws Exception {
public void logsOutput() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
this.initializer.initialize(context);
context.register(Config.class);
@@ -119,7 +119,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
}
@Test
public void canBeUsedInApplicationContext() throws Exception {
public void canBeUsedInApplicationContext() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(Config.class);
new ConditionEvaluationReportLoggingListener().initialize(context);
@@ -128,7 +128,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
}
@Test
public void canBeUsedInNonGenericApplicationContext() throws Exception {
public void canBeUsedInNonGenericApplicationContext() {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.setServletContext(new MockServletContext());
context.register(Config.class);
@@ -138,7 +138,7 @@ public class ConditionEvaluationReportLoggingListenerTests {
}
@Test
public void noErrorIfNotInitialized() throws Exception {
public void noErrorIfNotInitialized() {
this.initializer
.onApplicationEvent(new ApplicationFailedEvent(new SpringApplication(),
new String[0], null, new RuntimeException("Planned")));

View File

@@ -172,7 +172,7 @@ public class MailSenderAutoConfigurationTests {
}
@Test
public void jndiSessionNotAvailableWithJndiName() throws NamingException {
public void jndiSessionNotAvailableWithJndiName() {
this.thrown.expect(BeanCreationException.class);
this.thrown.expectMessage("Unable to find Session in JNDI location foo");
load(EmptyConfig.class, "spring.mail.jndi-name:foo");
@@ -195,7 +195,7 @@ public class MailSenderAutoConfigurationTests {
}
private Session configureJndiSession(String name)
throws IllegalStateException, NamingException {
throws IllegalStateException {
Properties properties = new Properties();
Session session = Session.getDefaultInstance(properties);
TestableInitialContextFactory.bind(name, session);

View File

@@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.mongo;
import java.net.UnknownHostException;
import java.util.List;
import com.mongodb.MongoClient;
@@ -114,7 +113,7 @@ public class MongoPropertiesTests {
}
@Test
public void uriOverridesHostAndPort() throws UnknownHostException {
public void uriOverridesHostAndPort() {
MongoProperties properties = new MongoProperties();
properties.setHost("localhost");
properties.setPort(27017);
@@ -127,7 +126,7 @@ public class MongoPropertiesTests {
}
@Test
public void onlyHostAndPortSetShouldUseThat() throws UnknownHostException {
public void onlyHostAndPortSetShouldUseThat() {
MongoProperties properties = new MongoProperties();
properties.setHost("localhost");
properties.setPort(27017);
@@ -139,7 +138,7 @@ public class MongoPropertiesTests {
}
@Test
public void onlyUriSetShouldUseThat() throws UnknownHostException {
public void onlyUriSetShouldUseThat() {
MongoProperties properties = new MongoProperties();
properties.setUri("mongodb://mongo1.example.com:12345");
MongoClient client = new MongoClientFactory(properties, null)
@@ -150,7 +149,7 @@ public class MongoPropertiesTests {
}
@Test
public void noCustomAddressAndNoUriUsesDefaultUri() throws UnknownHostException {
public void noCustomAddressAndNoUriUsesDefaultUri() {
MongoProperties properties = new MongoProperties();
MongoClient client = new MongoClientFactory(properties, null)
.createMongoClient(null);

View File

@@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.mongo;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.List;
@@ -51,7 +50,7 @@ public class ReactiveMongoClientFactoryTests {
private MockEnvironment environment = new MockEnvironment();
@Test
public void portCanBeCustomized() throws UnknownHostException {
public void portCanBeCustomized() {
MongoProperties properties = new MongoProperties();
properties.setPort(12345);
MongoClient client = createMongoClient(properties);
@@ -61,7 +60,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void hostCanBeCustomized() throws UnknownHostException {
public void hostCanBeCustomized() {
MongoProperties properties = new MongoProperties();
properties.setHost("mongo.example.com");
MongoClient client = createMongoClient(properties);
@@ -71,7 +70,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void credentialsCanBeCustomized() throws UnknownHostException {
public void credentialsCanBeCustomized() {
MongoProperties properties = new MongoProperties();
properties.setUsername("user");
properties.setPassword("secret".toCharArray());
@@ -81,7 +80,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void databaseCanBeCustomized() throws UnknownHostException {
public void databaseCanBeCustomized() {
MongoProperties properties = new MongoProperties();
properties.setDatabase("foo");
properties.setUsername("user");
@@ -92,7 +91,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void authenticationDatabaseCanBeCustomized() throws UnknownHostException {
public void authenticationDatabaseCanBeCustomized() {
MongoProperties properties = new MongoProperties();
properties.setAuthenticationDatabase("foo");
properties.setUsername("user");
@@ -103,7 +102,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void uriCanBeCustomized() throws UnknownHostException {
public void uriCanBeCustomized() {
MongoProperties properties = new MongoProperties();
properties.setUri("mongodb://user:secret@mongo1.example.com:12345,"
+ "mongo2.example.com:23456/test");
@@ -118,7 +117,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void uriCannotBeSetWithCredentials() throws UnknownHostException {
public void uriCannotBeSetWithCredentials() {
MongoProperties properties = new MongoProperties();
properties.setUri("mongodb://127.0.0.1:1234/mydb");
properties.setUsername("user");
@@ -130,7 +129,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void uriCannotBeSetWithHostPort() throws UnknownHostException {
public void uriCannotBeSetWithHostPort() {
MongoProperties properties = new MongoProperties();
properties.setUri("mongodb://127.0.0.1:1234/mydb");
properties.setHost("localhost");
@@ -142,7 +141,7 @@ public class ReactiveMongoClientFactoryTests {
}
@Test
public void uriIsIgnoredInEmbeddedMode() throws UnknownHostException {
public void uriIsIgnoredInEmbeddedMode() {
MongoProperties properties = new MongoProperties();
properties.setUri("mongodb://mongo.example.com:1234/mydb");
this.environment.setProperty("local.mongo.port", "4000");

View File

@@ -17,7 +17,6 @@
package org.springframework.boot.autoconfigure.mongo.embedded;
import java.io.File;
import java.net.UnknownHostException;
import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.config.IMongodConfig;
@@ -190,8 +189,7 @@ public class EmbeddedMongoAutoConfigurationTests {
static class MongoClientConfiguration {
@Bean
public MongoClient mongoClient(@Value("${local.mongo.port}") int port)
throws UnknownHostException {
public MongoClient mongoClient(@Value("${local.mongo.port}") int port) {
return new MongoClient("localhost", port);
}

View File

@@ -58,14 +58,14 @@ public class MustacheAutoConfigurationReactiveIntegrationTests {
private WebTestClient client;
@Test
public void testHomePage() throws Exception {
public void testHomePage() {
String result = this.client.get().uri("/").exchange().expectStatus().isOk()
.expectBody(String.class).returnResult().getResponseBody();
assertThat(result).contains("Hello App").contains("Hello World");
}
@Test
public void testPartialPage() throws Exception {
public void testPartialPage() {
String result = this.client.get().uri("/partial").exchange().expectStatus().isOk()
.expectBody(String.class).returnResult().getResponseBody();
assertThat(result).contains("Hello App").contains("Hello World");

View File

@@ -83,14 +83,14 @@ public class MustacheAutoConfigurationServletIntegrationTests {
}
@Test
public void testHomePage() throws Exception {
public void testHomePage() {
String body = new TestRestTemplate().getForObject("http://localhost:" + this.port,
String.class);
assertThat(body.contains("Hello World")).isTrue();
}
@Test
public void testPartialPage() throws Exception {
public void testPartialPage() {
String body = new TestRestTemplate()
.getForObject("http://localhost:" + this.port + "/partial", String.class);
assertThat(body.contains("Hello World")).isTrue();

View File

@@ -48,26 +48,26 @@ public class MustacheStandaloneIntegrationTests {
private Mustache.Compiler compiler;
@Test
public void directCompilation() throws Exception {
public void directCompilation() {
assertThat(this.compiler.compile("Hello: {{world}}")
.execute(Collections.singletonMap("world", "World")))
.isEqualTo("Hello: World");
}
@Test
public void environmentCollectorCompoundKey() throws Exception {
public void environmentCollectorCompoundKey() {
assertThat(this.compiler.compile("Hello: {{env.foo}}").execute(new Object()))
.isEqualTo("Hello: There");
}
@Test
public void environmentCollectorCompoundKeyStandard() throws Exception {
public void environmentCollectorCompoundKeyStandard() {
assertThat(this.compiler.standardsMode(true).compile("Hello: {{env.foo}}")
.execute(new Object())).isEqualTo("Hello: There");
}
@Test
public void environmentCollectorSimpleKey() throws Exception {
public void environmentCollectorSimpleKey() {
assertThat(this.compiler.compile("Hello: {{foo}}").execute(new Object()))
.isEqualTo("Hello: World");
}

View File

@@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock;
public class DatabaseLookupTests {
@Test
public void getDatabaseWhenDataSourceIsNullShouldReturnDefault() throws Exception {
public void getDatabaseWhenDataSourceIsNullShouldReturnDefault() {
assertThat(DatabaseLookup.getDatabase(null)).isEqualTo(Database.DEFAULT);
}

View File

@@ -28,7 +28,6 @@ import java.util.Vector;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
@@ -319,7 +318,7 @@ public class HibernateJpaAutoConfigurationTests
}
@Override
public int getCurrentStatus() throws SystemException {
public int getCurrentStatus() {
throw new UnsupportedOperationException();
}

View File

@@ -61,7 +61,7 @@ public class JpaPropertiesTests {
}
@Test
public void noCustomNamingStrategy() throws Exception {
public void noCustomNamingStrategy() {
JpaProperties properties = load();
Map<String, Object> hibernateProperties = properties
.getHibernateProperties(new HibernateSettings().ddlAuto("none"));
@@ -76,7 +76,7 @@ public class JpaPropertiesTests {
}
@Test
public void hibernate5CustomNamingStrategies() throws Exception {
public void hibernate5CustomNamingStrategies() {
JpaProperties properties = load(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical");
@@ -90,7 +90,7 @@ public class JpaPropertiesTests {
}
@Test
public void namingStrategyInstancesCanBeUsed() throws Exception {
public void namingStrategyInstancesCanBeUsed() {
JpaProperties properties = load();
ImplicitNamingStrategy implicitStrategy = mock(ImplicitNamingStrategy.class);
PhysicalNamingStrategy physicalStrategy = mock(PhysicalNamingStrategy.class);
@@ -106,8 +106,7 @@ public class JpaPropertiesTests {
}
@Test
public void namingStrategyInstancesTakePrecedenceOverNamingStrategyProperties()
throws Exception {
public void namingStrategyInstancesTakePrecedenceOverNamingStrategyProperties() {
JpaProperties properties = load(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical");
@@ -125,7 +124,7 @@ public class JpaPropertiesTests {
}
@Test
public void hibernate5CustomNamingStrategiesViaJpaProperties() throws Exception {
public void hibernate5CustomNamingStrategiesViaJpaProperties() {
JpaProperties properties = load(
"spring.jpa.properties.hibernate.implicit_naming_strategy:com.example.Implicit",
"spring.jpa.properties.hibernate.physical_naming_strategy:com.example.Physical");
@@ -140,7 +139,7 @@ public class JpaPropertiesTests {
}
@Test
public void useNewIdGeneratorMappingsDefault() throws Exception {
public void useNewIdGeneratorMappingsDefault() {
JpaProperties properties = load();
Map<String, Object> hibernateProperties = properties
.getHibernateProperties(new HibernateSettings().ddlAuto("none"));
@@ -149,7 +148,7 @@ public class JpaPropertiesTests {
}
@Test
public void useNewIdGeneratorMappingsFalse() throws Exception {
public void useNewIdGeneratorMappingsFalse() {
JpaProperties properties = load(
"spring.jpa.hibernate.use-new-id-generator-mappings:false");
Map<String, Object> hibernateProperties = properties

View File

@@ -28,7 +28,6 @@ import org.quartz.Calendar;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
@@ -362,8 +361,7 @@ public class QuartzAutoConfigurationTests {
private String jobDataKey;
@Override
protected void executeInternal(JobExecutionContext context)
throws JobExecutionException {
protected void executeInternal(JobExecutionContext context) {
System.out.println(this.env.getProperty("test-name", "unknown") + " - "
+ this.jobDataKey);
}

View File

@@ -80,7 +80,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void testWebConfiguration() throws Exception {
public void testWebConfiguration() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(SecurityAutoConfiguration.class,
@@ -92,7 +92,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void testDefaultFilterOrderWithSecurityAdapter() throws Exception {
public void testDefaultFilterOrderWithSecurityAdapter() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(WebSecurity.class, SecurityAutoConfiguration.class,
@@ -105,7 +105,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void testFilterIsNotRegisteredInNonWeb() throws Exception {
public void testFilterIsNotRegisteredInNonWeb() {
try (AnnotationConfigApplicationContext customContext = new AnnotationConfigApplicationContext()) {
customContext.register(SecurityAutoConfiguration.class,
SecurityFilterAutoConfiguration.class,
@@ -117,7 +117,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void testDefaultFilterOrder() throws Exception {
public void testDefaultFilterOrder() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(SecurityAutoConfiguration.class,
@@ -130,7 +130,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void testCustomFilterOrder() throws Exception {
public void testCustomFilterOrder() {
this.context = new AnnotationConfigWebApplicationContext();
TestPropertyValues.of("spring.security.filter.order:12345").applyTo(this.context);
this.context.setServletContext(new MockServletContext());
@@ -143,7 +143,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void testDefaultUsernamePassword() throws Exception {
public void testDefaultUsernamePassword() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(SecurityAutoConfiguration.class);
@@ -155,8 +155,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void defaultUserNotCreatedIfAuthenticationManagerBeanPresent()
throws Exception {
public void defaultUserNotCreatedIfAuthenticationManagerBeanPresent() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(TestAuthenticationManagerConfiguration.class,
@@ -173,7 +172,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void defaultUserNotCreatedIfUserDetailsServiceBeanPresent() throws Exception {
public void defaultUserNotCreatedIfUserDetailsServiceBeanPresent() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(TestUserDetailsServiceConfiguration.class,
@@ -188,8 +187,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void defaultUserNotCreatedIfAuthenticationProviderBeanPresent()
throws Exception {
public void defaultUserNotCreatedIfAuthenticationProviderBeanPresent() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(TestAuthenticationProviderConfiguration.class,
@@ -205,7 +203,7 @@ public class SecurityAutoConfigurationTests {
}
@Test
public void testJpaCoexistsHappily() throws Exception {
public void testJpaCoexistsHappily() {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
TestPropertyValues

View File

@@ -16,10 +16,7 @@
package org.springframework.boot.autoconfigure.security;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
@@ -59,7 +56,7 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests {
public OutputCapture outputCapture = new OutputCapture();
@Test
public void testSecurityFilterDoesNotCauseEarlyInitialization() throws Exception {
public void testSecurityFilterDoesNotCauseEarlyInitialization() {
try (AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext()) {
TestPropertyValues.of("server.port:0").applyTo(context);
context.register(Config.class);
@@ -127,8 +124,7 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests {
}
@Override
public SourceType deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
public SourceType deserialize(JsonParser p, DeserializationContext ctxt) {
return new SourceType();
}

Some files were not shown because too many files have changed in this diff Show More