How do I set a property on a mocked object using Mockito?

后端 未结 3 1115
执念已碎
执念已碎 2020-12-18 22:55

I have a scenario where I have to set a property of a mocked object as follows:

SlingHttpRequest slingHttpRequest= mock(SlingHttpRequest);
slingHttpRequest.s         


        
3条回答
  •  佛祖请我去吃肉
    2020-12-18 23:44

    Mock object is not where you store data, it's for you to teach the behavior when its methods are invoked.

    try this: https://www.google.com/search?q=mockito+example&oq=mockito+example&aqs=chrome..69i57j0l5.6790j0j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

提交回复
热议问题