EasyMock: Mock out a constructor call in java

前端 未结 4 1082
生来不讨喜
生来不讨喜 2021-01-05 03:11

I have a looked at similar questions on this board, but none of them answer my question. This sound strange, but is it possible to mock out a constructor call on the object

4条回答
  •  隐瞒了意图╮
    2021-01-05 04:00

    You can't do this with easymock, as it doesn't support mocking constructors. There's a library called powermock which can do that and is the only mocking library, as far as I know, that can stub constructors and static methods in Java.

提交回复
热议问题