mock stream java code example Example: mock stream java when(mock.streamMethod()).thenAnswer(invocation -> Stream.of("A", "B"))