【发布时间】:2019-12-24 14:47:59
【问题描述】:
我正在尝试编写 mockito when 方法,以便在调用方法时可以定义返回的数据。 java方法:
when(myRepository.insertNote(any(Note.class))).thenReturn(returnedData);
在 kotlin 中,我正在尝试编写相同的内容,但它没有显示在 when() 之后编写 thenReturn() 的选项.我正在尝试:
when(mainRepository.fetchApiresultFromClient(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(),ArgumentMatchers.anyString(), ArgumentMatchers.anyInt()) )
.thenReturn(returnedData)
我该如何解决?
【问题讨论】:
标签: unit-testing kotlin mockito