我正在为控制器端点编写测试,当我执行时,我总是得到一个空值。当我调用测试方法进行调试以检查我的呼叫是否到达端点时,有什么方法吗?
e.g。 我的测试
@ActiveProfiles("local")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { Application.class })
@WebIntegrationTest("server.port:0")
@Slf4j
public class XYZControllerTest{
.
.
.
@Test
public void testEndpointXYZ(){
...
Message createdMessage = testRestTemplate.exchange(postRequest, Message.class).getBody();
}
}
以上呼叫始终返回null。
请建议一种调试方法,以便确保我到达控制器中的端点。