Files
spring-boot/smoke-test/spring-boot-smoke-test-jetty-jsp/src/test/java/smoketest/jetty/jsp/SampleWebJspApplicationTests.java
T
Brian Clozel 2f9933e3cb Replace TestRestTemplate with RestTestClient in smoke tests
Before deprecating `TestRestTemplate`, we must first stop using it in
smoke tests and replace it with:
* `RestTestClient` when the Spring MVC infrastructure is present
* `RestClient` when the test does not have Spring MVC on classpath

See gh-46632
2026-07-27 16:09:12 +02:00

51 lines
1.5 KiB
Java

/*
* Copyright 2012-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package smoketest.jetty.jsp;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureRestTestClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.web.servlet.client.RestTestClient;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Basic integration tests for JSP application.
*
* @author Phillip Webb
*/
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@AutoConfigureRestTestClient
class SampleWebJspApplicationTests {
@Autowired
private RestTestClient restTestClient;
@Test
void testJspWithEl() {
this.restTestClient.get()
.uri("/")
.exchangeSuccessfully()
.expectBody(String.class)
.value((body) -> assertThat(body).contains("/resources/text.txt"));
}
}