Commit 30ff329e authored by Phillip Webb's avatar Phillip Webb

Polish

parent 71ade559
......@@ -51,9 +51,10 @@ public class LiquibaseEndpointTests extends AbstractEndpointTests<LiquibaseEndpo
public void invokeWithCustomSchema() throws Exception {
this.context.close();
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("liquibase.default-schema=CUSTOMSCHEMA",
"spring.datasource.generate-unique-name=true",
"spring.datasource.schema=classpath:/db/create-custom-schema.sql")
TestPropertyValues
.of("liquibase.default-schema=CUSTOMSCHEMA",
"spring.datasource.generate-unique-name=true",
"spring.datasource.schema=classpath:/db/create-custom-schema.sql")
.applyTo(this.context);
this.context.register(CustomSchemaConfig.class);
this.context.refresh();
......
......@@ -53,24 +53,24 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
@Test
public void registrationIfHazelcastInstanceHasRegularBeanName() {
this.contextRunner.withUserConfiguration(
HazelcastConfiguration.class).run((context) -> {
assertThat(postProcessors(context))
.containsKey("hazelcastInstanceJpaDependencyPostProcessor");
assertThat(entityManagerFactoryDependencies(context)).contains(
"hazelcastInstance");
});
this.contextRunner.withUserConfiguration(HazelcastConfiguration.class)
.run((context) -> {
assertThat(postProcessors(context))
.containsKey("hazelcastInstanceJpaDependencyPostProcessor");
assertThat(entityManagerFactoryDependencies(context))
.contains("hazelcastInstance");
});
}
@Test
public void noRegistrationIfHazelcastInstanceHasCustomBeanName() {
this.contextRunner.withUserConfiguration(
HazelcastCustomNameConfiguration.class).run((context) -> {
assertThat(entityManagerFactoryDependencies(context))
.doesNotContain("hazelcastInstance");
assertThat(postProcessors(context))
.doesNotContainKey("hazelcastInstanceJpaDependencyPostProcessor");
});
this.contextRunner.withUserConfiguration(HazelcastCustomNameConfiguration.class)
.run((context) -> {
assertThat(entityManagerFactoryDependencies(context))
.doesNotContain("hazelcastInstance");
assertThat(postProcessors(context)).doesNotContainKey(
"hazelcastInstanceJpaDependencyPostProcessor");
});
}
@Test
......@@ -86,8 +86,8 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
@Test
public void noRegistrationWithNoEntityManagerFactory() {
new ApplicationContextRunner().withUserConfiguration(HazelcastConfiguration.class)
.withConfiguration(AutoConfigurations.of(
HazelcastJpaDependencyAutoConfiguration.class))
.withConfiguration(AutoConfigurations
.of(HazelcastJpaDependencyAutoConfiguration.class))
.run((context) -> assertThat(postProcessors(context)).doesNotContainKey(
"hazelcastInstanceJpaDependencyPostProcessor"));
}
......@@ -99,13 +99,13 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
private List<String> entityManagerFactoryDependencies(
AssertableApplicationContext context) {
String[] dependsOn = ((BeanDefinitionRegistry) context.getSourceApplicationContext())
.getBeanDefinition("entityManagerFactory").getDependsOn();
String[] dependsOn = ((BeanDefinitionRegistry) context
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
.getDependsOn();
return dependsOn != null ? Arrays.asList(dependsOn)
: Collections.<String>emptyList();
}
@Configuration
static class HazelcastConfiguration {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment