Using wiremock, can I return a body that is dependent on the post request

后端 未结 6 851
盖世英雄少女心
盖世英雄少女心 2021-02-12 20:10

I am trying to test an openid provider class. The openid consumer class is making an http request. I am mocking the response to this request using wiremock. I am trying to mock

6条回答
  •  死守一世寂寞
    2021-02-12 20:42

    As far as I know and my experience with WireMock, no.

    You can't parameterize a response with arguments passed through request. The best you can do is use matchers to make your mocked server respond accordingly.

    I would recommend you making some unit or integration tests with plain jUnit in order to test requests/responses in such cases. They should be quicker if you want to test that receipt requests are responding correctly. I see WireMock as an alternative to do acceptance test, to ensure that your interface with other REST services are not getting broken.

提交回复
热议问题