1

Springockito とスパイを使用して、エンド ツー エンド テスト中にサービス メソッドで呼び出しが行われたかどうかを確認しようとしています。プロセスも取得するサービスを自動配線し、それをスパイします。myService インスタンスはインストルメント化されていますが、verify() は以前の呼び出しを検証せず、元のメソッドを呼び出して null パラメーターを渡します。どうしてこれなの?

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = PatchedSpringockitoContextLoader.class, locations = {
    "classpath:/config.xml"
})
...
@Autowired
@WrapWithSpy
private MyService myService;
...
@Before
public void setup() {
    initMocks(this);
    ...
}
...
@Test
public void test() {
    // run the process that may or may not call the service
    verify(myService, never()).myMethod(any(MyParam.class));
}
4

1 に答える 1