How to mock constructor with PowerMockito

后端 未结 1 1525
梦谈多话
梦谈多话 2020-12-03 18:12

I\'m trying to mock a class constructor with PowerMockito for first time, but it doesn\'t work. My current code is:

public class Bar {
    public String getT         


        
1条回答
  •  广开言路
    2020-12-03 18:29

    Okey, found the answer, you need to call to

    @PrepareForTest(Foo.class)
    

    instead of

    @PrepareForTest(Bar.class)
    

    0 讨论(0)
提交回复
热议问题