JAVA-31190: Preparation for migrating spring-boot-modules to version 3. (#15834)

This commit is contained in:
Harry9656
2024-02-27 02:49:02 +01:00
committed by GitHub
parent 74da22b9c4
commit aefd833c3b
190 changed files with 1052 additions and 832 deletions
@@ -30,10 +30,18 @@
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<springfox.version>3.0.0</springfox.version>
<rest-assured.version>5.4.0</rest-assured.version>
<start-class>com.baeldung.apiswagger.Application</start-class>
</properties>
</project>
@@ -1,33 +1,33 @@
package com.baeldung.swaggerconf;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@AutoConfigureMockMvc
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SwaggerConfExcludeErrorControllerIntegrationTest {
@Disabled("springfox-boot-starter is not maintained anymore. Use spring-doc")
class SwaggerConfExcludeErrorControllerIntegrationTest {
@Autowired
private MockMvc mvc;
@Test
public void whenCallingSwaggerJSON_stringObjectDoesNotContainAnyErrorControllers() throws Exception {
void whenCallingSwaggerJSON_stringObjectDoesNotContainAnyErrorControllers() throws Exception {
ResultActions resultActions = mvc.perform(get("/v2/api-docs")).andExpect(status().isOk());
MvcResult result = resultActions.andReturn();
String content = result.getResponse().getContentAsString();
Assert.assertNotNull(content);
Assert.assertFalse(content.contains("error-controller"));
assertNotNull(content);
assertFalse(content.contains("error-controller"));
}
}