SpringBoot项目单元测试不经过过滤器问题

SpringBoot使用MockMvc:https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-mock-environment

使用MockMvc对象进行请求,不会进行一个完整的请求(就是说不会经过过滤器,异常处理等操作)

需要完整的请求请按  https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-running-server  这个文档使用即可,,

这是jsonpath的文档:https://github.com/json-path/JsonPath  ,一个解析工具

复制请注明出处,在世界中挣扎的灰太狼
原文地址:https://www.cnblogs.com/XingXiaoMeng/p/13661998.html