How to mock ObjectMapper.readValue() using mockito

后端 未结 3 1657
野趣味
野趣味 2021-02-20 17:29

I\'m testing a service layer and not sure how to mock ObjectMapper().readValue in that class. I\'m fairly new to mockito and could figure out how to do

3条回答
  •  深忆病人
    2021-02-20 17:56

    Mocking objects created in a SUT is IMO the single biggest limitation of mockito. Use jmockit or powerMock or checkout the offical mockito way of handling this. https://github.com/mockito/mockito/wiki/Mocking-Object-Creation

提交回复
热议问题