Optional cannot be returned by stream() in Mockito Test classes

后端 未结 1 1750
暖寄归人
暖寄归人 2020-12-18 17:48

I am developing Test cases for the Spring Data Mongo Services.

org.mockito.exceptions.misusing.WrongTypeOfReturnValue: 
Optional cannot be retu         


        
1条回答
  •  一向
    一向 (楼主)
    2020-12-18 18:17

    I was able to fixed using below:

    when(pageable.getSort()).thenReturn(Sort.by(order));
    

    This works like charm !

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