Merge pull request #51722 from noojung

Closes gh-51722

* gh-51722:
  Fix duplicated tests
This commit is contained in:
Andy Wilkinson
2026-09-15 13:01:50 +01:00
7 changed files with 9 additions and 34 deletions
@@ -174,7 +174,7 @@ class ConditionalOnPropertyTests {
@Test
void relaxedEnabledByDefault() {
load(PrefixValueConfig.class, "simple.myProperty:bar");
load(PrefixValueConfig.class, "simple.my-property:bar");
assertThat(containsBean()).isTrue();
}
@@ -81,12 +81,6 @@ class ConfigDataResourceNotFoundExceptionTests {
assertThat(exception.getCause()).isSameAs(this.cause);
}
@Test
void getResourceReturnsResource() {
ConfigDataResourceNotFoundException exception = new ConfigDataResourceNotFoundException(this.resource);
assertThat(exception.getResource()).isSameAs(this.resource);
}
@Test
void getLocationWhenHasNoLocationReturnsNull() {
ConfigDataResourceNotFoundException exception = new ConfigDataResourceNotFoundException(this.resource);
@@ -294,16 +294,15 @@ class EnvironmentEndpointTests {
@Test
void propertyEntryWhenShowWhenAuthorized() {
testPropertyEntry(Show.ALWAYS, "bar", "another");
testPropertyEntry(Show.WHEN_AUTHORIZED, "bar", "another");
}
private void testPropertyEntry(Show always, String bar, String another) {
private void testPropertyEntry(Show show, String bar, String another) {
TestPropertyValues.of("my.foo=another").applyToSystemProperties(() -> {
StandardEnvironment environment = new StandardEnvironment();
TestPropertyValues.of("my.foo=bar", "my.foo2=bar2")
.applyTo(environment, TestPropertyValues.Type.MAP, "test");
EnvironmentEntryDescriptor descriptor = new EnvironmentEndpoint(environment, Collections.emptyList(),
always)
EnvironmentEntryDescriptor descriptor = new EnvironmentEndpoint(environment, Collections.emptyList(), show)
.environmentEntry("my.foo");
assertThat(descriptor).isNotNull();
assertThat(descriptor.getProperty()).isNotNull();
@@ -60,13 +60,7 @@ class ChangeableUrlsTests {
}
@Test
void httpUrl() throws Exception {
URL url = new URL("https://spring.io");
assertThat(ChangeableUrls.fromUrls(url)).isEmpty();
}
@Test
void httpsUrl() throws Exception {
void nonFileUrl() throws Exception {
URL url = new URL("https://spring.io");
assertThat(ChangeableUrls.fromUrls(url)).isEmpty();
}
@@ -58,7 +58,8 @@ class MongoAutoConfigurationTests {
@Test
void settingsAdded() {
this.contextRunner.withUserConfiguration(SettingsConfig.class)
this.contextRunner.withPropertyValues("spring.mongodb.host:localhost")
.withUserConfiguration(SettingsConfig.class)
.run((context) -> assertThat(
getSettings(context).getSocketSettings().getConnectTimeout(TimeUnit.MILLISECONDS))
.isEqualTo(300));
@@ -66,7 +67,8 @@ class MongoAutoConfigurationTests {
@Test
void settingsAddedButNoHost() {
this.contextRunner.withUserConfiguration(SettingsConfig.class)
this.contextRunner.withPropertyValues("spring.mongodb.uri:mongodb://localhost/test")
.withUserConfiguration(SettingsConfig.class)
.run((context) -> assertThat(
getSettings(context).getSocketSettings().getConnectTimeout(TimeUnit.MILLISECONDS))
.isEqualTo(300));
@@ -259,14 +259,6 @@ class Neo4jAutoConfigurationTests {
assertThat(mapDriverConfig(properties).encrypted()).isTrue();
}
@Test
void securityWithTrustSignedCertificates() {
Neo4jProperties properties = new Neo4jProperties();
properties.getSecurity().setTrustStrategy(TrustStrategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES);
assertThat(mapDriverConfig(properties).trustStrategy().strategy())
.isEqualTo(Config.TrustStrategy.Strategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES);
}
@Test
void securityWithTrustAllCertificates() {
Neo4jProperties properties = new Neo4jProperties();
@@ -171,12 +171,6 @@ class TomcatServerPropertiesTests {
assertThat(this.properties.getThreads().getMinSpare()).isEqualTo(getDefaultProtocol().getMinSpareThreads());
}
@Test
void tomcatMaxHttpPostSizeMatchesConnectorDefault() {
assertThat(this.properties.getMaxHttpFormPostSize().toBytes())
.isEqualTo(getDefaultConnector().getMaxPostSize());
}
@Test
void tomcatMaxParameterCountMatchesConnectorDefault() {
assertThat(this.properties.getMaxParameterCount()).isEqualTo(getDefaultConnector().getMaxParameterCount());