mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-03 15:59:31 +00:00
Adapt to deprecations in latest Framework snaphots
See gh-47850
This commit is contained in:
+8
-5
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.actuate.context.properties;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
@@ -30,8 +31,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link ConfigurationPropertiesReportEndpoint} exposed by Jersey,
|
||||
@@ -50,6 +50,7 @@ class ConfigurationPropertiesReportEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@WebEndpointTest
|
||||
@SuppressWarnings("unchecked")
|
||||
void noFilters() {
|
||||
this.client.get()
|
||||
.uri("/actuator/configprops")
|
||||
@@ -58,7 +59,7 @@ class ConfigurationPropertiesReportEndpointWebIntegrationTests {
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.jsonPath("$..beans[*]")
|
||||
.value(hasSize(greaterThanOrEqualTo(2)))
|
||||
.value(List.class, (beans) -> assertThat(beans).hasSizeGreaterThanOrEqualTo(2))
|
||||
.jsonPath("$..beans['fooDotCom']")
|
||||
.exists()
|
||||
.jsonPath("$..beans['barDotCom']")
|
||||
@@ -66,6 +67,7 @@ class ConfigurationPropertiesReportEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@WebEndpointTest
|
||||
@SuppressWarnings("unchecked")
|
||||
void filterByExactPrefix() {
|
||||
this.client.get()
|
||||
.uri("/actuator/configprops/com.foo")
|
||||
@@ -74,12 +76,13 @@ class ConfigurationPropertiesReportEndpointWebIntegrationTests {
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.jsonPath("$..beans[*]")
|
||||
.value(hasSize(1))
|
||||
.value(List.class, (beans) -> assertThat(beans).hasSize(1))
|
||||
.jsonPath("$..beans['fooDotCom']")
|
||||
.exists();
|
||||
}
|
||||
|
||||
@WebEndpointTest
|
||||
@SuppressWarnings("unchecked")
|
||||
void filterByGeneralPrefix() {
|
||||
this.client.get()
|
||||
.uri("/actuator/configprops/com.")
|
||||
@@ -88,7 +91,7 @@ class ConfigurationPropertiesReportEndpointWebIntegrationTests {
|
||||
.isOk()
|
||||
.expectBody()
|
||||
.jsonPath("$..beans[*]")
|
||||
.value(hasSize(2))
|
||||
.value(List.class, (beans) -> assertThat(beans).hasSize(2))
|
||||
.jsonPath("$..beans['fooDotCom']")
|
||||
.exists()
|
||||
.jsonPath("$..beans['barDotCom']")
|
||||
|
||||
+11
-3
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minidev.json.JSONArray;
|
||||
import org.hamcrest.collection.IsIterableContainingInAnyOrder;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.mockito.Mockito;
|
||||
@@ -39,9 +38,11 @@ import org.springframework.boot.logging.LoggingSystem;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.then;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -64,6 +65,9 @@ class LoggersEndpointWebIntegrationTests {
|
||||
|
||||
private static final String V3_JSON = ApiVersion.V3.getProducedMimeType().toString();
|
||||
|
||||
private static final ParameterizedTypeReference<List<String>> STRING_LIST = new ParameterizedTypeReference<>() {
|
||||
};
|
||||
|
||||
private WebTestClient client;
|
||||
|
||||
private LoggingSystem loggingSystem;
|
||||
@@ -134,6 +138,7 @@ class LoggersEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@WebEndpointTest
|
||||
@SuppressWarnings("unchecked")
|
||||
void getLoggerGroupShouldReturnConfiguredLogLevelAndMembers() {
|
||||
setLogLevelToDebug("test");
|
||||
this.client.get()
|
||||
@@ -145,7 +150,8 @@ class LoggersEndpointWebIntegrationTests {
|
||||
.jsonPath("$.length()")
|
||||
.isEqualTo(2)
|
||||
.jsonPath("members")
|
||||
.value(IsIterableContainingInAnyOrder.containsInAnyOrder("test.member1", "test.member2"))
|
||||
.value(STRING_LIST,
|
||||
(members) -> assertThat(members).containsExactlyInAnyOrder("test.member1", "test.member2"))
|
||||
.jsonPath("configuredLevel")
|
||||
.isEqualTo("DEBUG");
|
||||
}
|
||||
@@ -293,6 +299,7 @@ class LoggersEndpointWebIntegrationTests {
|
||||
}
|
||||
|
||||
@WebEndpointTest
|
||||
@SuppressWarnings("unchecked")
|
||||
void logLevelForLoggerGroupWithNameThatCouldBeMistakenForAPathExtension() {
|
||||
setLogLevelToDebug("group.png");
|
||||
this.client.get()
|
||||
@@ -306,7 +313,8 @@ class LoggersEndpointWebIntegrationTests {
|
||||
.jsonPath("configuredLevel")
|
||||
.isEqualTo("DEBUG")
|
||||
.jsonPath("members")
|
||||
.value(IsIterableContainingInAnyOrder.containsInAnyOrder("png.member1", "png.member2"));
|
||||
.value(STRING_LIST,
|
||||
(members) -> assertThat(members).containsExactlyInAnyOrder("png.member1", "png.member2"));
|
||||
}
|
||||
|
||||
private void setLogLevelToDebug(String name) {
|
||||
|
||||
+2
-2
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import graphql.schema.idl.TypeRuntimeWiring;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -53,7 +54,6 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
/**
|
||||
* Tests for {@link GraphQlWebFluxAutoConfiguration}
|
||||
@@ -209,7 +209,7 @@ class GraphQlWebFluxAutoConfigurationTests {
|
||||
.expectHeader()
|
||||
.contentType(MediaType.TEXT_PLAIN)
|
||||
.expectBody(String.class)
|
||||
.value(containsString("type Book")));
|
||||
.value((Consumer<@Nullable String>) (body) -> assertThat(body).contains("type Book")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user