Check out example codes for "spring mock Streamble of object". It will help you in understanding the concepts better.

Code Example 1

Answer<Stream> answer = new Answer<Stream>() {
    public Stream answer(InvocationOnMock invocation) throws Throwable {
        return Stream.of("A", "B");
    }
};


when(mock.streamMethod()).thenAnswer(answer);

Learn ReactJs, React Native from akashmittal.com