Skip to content
Snippets Groups Projects
Commit 64bdbc3c authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4814 Reverted back to MockMvc in MongoConfigServerITCase

parent 9cd4758e
No related branches found
No related tags found
No related merge requests found
package de.ozgcloud.admin.environment;
import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.cloud.config.environment.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.test.web.servlet.MockMvc;
import de.ozgcloud.common.test.ITCase;
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
@ITCase
@AutoConfigureMockMvc
class MongoConfigServerITCase {
@LocalServerPort
private int port;
@Autowired
private MockMvc mockMvc;
@Test
void shouldHaveHttpEndpoint() throws Exception {
ResponseEntity<Environment> response = new TestRestTemplate().getForEntity("http://localhost:"
+ port + "/" + MongoPropertySourceTestFactory.APPNAME + "/" + MongoPropertySourceTestFactory.PROFILE, Environment.class);
var result = mockMvc.perform(get("/" + MongoPropertySourceTestFactory.APPNAME + "/" + MongoPropertySourceTestFactory.PROFILE));
assertEquals(HttpStatus.OK, response.getStatusCode());
result.andExpect(status().isOk());
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment