Commit 98738d22 authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Polish tests

See gh-20318
parent 296a13a4
......@@ -18,7 +18,6 @@ package org.springframework.boot.build.mavenplugin;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.junit.jupiter.api.Test;
......@@ -46,7 +45,7 @@ public class PluginXmlParserTests {
assertThat(plugin.getVersion()).isEqualTo("2.2.0.GRADLE-SNAPSHOT");
assertThat(plugin.getGoalPrefix()).isEqualTo("spring-boot");
assertThat(plugin.getMojos().stream().map(PluginXmlParser.Mojo::getGoal).collect(Collectors.toList()))
.isEqualTo(Arrays.<String>asList("build-info", "help", "repackage", "run", "start", "stop"));
.containsExactly("build-info", "help", "repackage", "run", "start", "stop");
}
@Test
......
......@@ -154,6 +154,7 @@ class DataSourceAutoConfigurationTests {
@Test
void dataSourceWhenNoConnectionPoolsAreAvailableWithUrlDoesNotCreateDataSource() {
this.contextRunner.with(hideConnectionPools())
.withPropertyValues("spring.datasource.url:jdbc:hsqldb:mem:testdb")
.run((context) -> assertThat(context).doesNotHaveBean(DataSource.class));
}
......@@ -210,8 +211,8 @@ class DataSourceAutoConfigurationTests {
}
private static Function<ApplicationContextRunner, ApplicationContextRunner> hideConnectionPools() {
return (runner) -> runner.withClassLoader(new FilteredClassLoader("org.apache.tomcat", "com.zaxxer.hikari",
"org.apache.commons.dbcp", "org.apache.commons.dbcp2"));
return (runner) -> runner.withClassLoader(
new FilteredClassLoader("org.apache.tomcat", "com.zaxxer.hikari", "org.apache.commons.dbcp2"));
}
private <T extends DataSource> void assertDataSource(Class<T> expectedType, List<String> hiddenPackages,
......
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