2021-02-13 11:38:55 +00:00
|
|
|
package com.baeldung;
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import org.springframework.mock.web.MockHttpServletResponse;
|
|
|
|
import org.springframework.test.web.servlet.MockMvc;
|
|
|
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
|
|
import org.springframework.web.context.WebApplicationContext;
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
|
|
|
|
|
|
@SpringBootTest
|
|
|
|
class JmeterIntegrationTest {
|
|
|
|
|
|
|
|
MockMvc mvc;
|
|
|
|
|
|
|
|
public JmeterIntegrationTest(WebApplicationContext wac) {
|
|
|
|
this.mvc = MockMvcBuilders.webAppContextSetup(wac).build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2021-02-20 11:19:12 +00:00
|
|
|
void whenCallingUUIDController_thenWeShouldRecieveRandomizedResponse() throws Exception {
|
|
|
|
MockHttpServletResponse response = mvc.perform(get("/api/uuid"))
|
2021-02-13 11:38:55 +00:00
|
|
|
.andDo(print())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andReturn()
|
|
|
|
.getResponse();
|
|
|
|
|
|
|
|
assertThat(response.getContentAsString())
|
|
|
|
.contains("Test message...");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|