3.7WebTestClient
3.7.1 Setup
client = WebTestClient.bindToController(new TestController()).build();RouterFunction<?> route = ...
client = WebTestClient.bindToRouterFunction(route).build(); @RunWith(SpringRunner.class)
@ContextConfiguration(classes = WebConfig.class)
public class MyTests {
@Autowired
private ApplicationContext context;
private WebTestClient client;
@Before
public void setUp() {
client = WebTestClient.bindToApplicationContext(context).build();
}3.7.2 写Tests
最后更新于
这有帮助吗?