Writing Mockito based junit test cases #197
Unanswered
ParthaNath28
asked this question in
Q&A
Replies: 1 comment
-
I am not an expert on mocking but I suspect that you only can have one layer of calls in the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
I has hoping to use mock test cases in my service layer just the way jpaRepository test cases are written.
@test
@DisplayName("Get all list")
public void testMyService() throws Exception {
when(jpaStreamer.stream(MyEntity.class)
.skip(20)
.limit(20)
.sorted((MyEntity.class)$.identifier)
.toList()).thenReturn(myEntityList);
The error message I got is like below. Just wondering if there is a documentation available for using in Mock based test cases
org.mockito.exceptions.misusing.WrongTypeOfReturnValue:
ArrayList cannot be returned by stream()
stream() should return Stream
Beta Was this translation helpful? Give feedback.
All reactions