JAVA-31190: Preparation for migrating spring-boot-modules to version 3. (#15834)
This commit is contained in:
@@ -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>
|
||||
+12
-12
@@ -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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user