/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
testing-modules/jmeter/src/test/java/com/baeldung/JmeterIntegrationTest.java
35 строк
1 KB
anuragkumawat
JAVA-29231 Move modules inside existing container modules (#15492)
01 янв 2024, 22:27
01 янв 2024, 22:27
2096eac
Код
Авторство
О чём код?
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 void whenCallingUUIDController_thenWeShouldRecieveRandomizedResponse() throws Exception { MockHttpServletResponse response = mvc.perform(get("/api/uuid")) .andDo(print()) .andExpect(status().isOk()) .andReturn() .getResponse(); assertThat(response.getContentAsString()) .contains("Test message..."); } }