【问题标题】:Testing a post request测试发布请求
【发布时间】:2012-07-31 14:12:07
【问题描述】:

在下面的问题中,我很困惑:handle = adapter.handle(req, res, vc);

Set @ModelAttribute in MockHttpServletRequest in JUnit Test

adapter 对象是如何/在哪里实例化的?

【问题讨论】:

    标签: java spring spring-mvc junit


    【解决方案1】:

    他所指的适配器对象是 SpringSource 文档中的 HandlerAdapter。更具体地说,它是AnnotationMethodHandlerAdapter的子类

    我还想在 Spring MVC 中测试我的 RESTful 服务。以下是对我非常有帮助的两个链接:

    Unit Testing Controllers in Spring MVC

    Using HandlerAdapter in integration tests

    【讨论】:

      【解决方案2】:

      adapterWebTestExecutionerListener 似乎都是 OP 自己的代码。不问问他就知道了。

      【讨论】:

        猜你喜欢
        • 2021-12-06
        • 1970-01-01
        • 1970-01-01
        • 2016-06-01
        • 2018-04-30
        • 1970-01-01
        • 2021-10-07
        • 2016-12-01
        • 1970-01-01
        相关资源
        最近更新 更多