Please provide the following information:
-
Version of JMockit that was used:
1.44
-
Description of the problem:
When I use a mocked list of anything, LocalDateTime.now() and make a stream out of a list, an exception occured:
java.lang.IllegalStateException: stream has already been operated upon or closed
Here is a minimal code example (junit-test)
@Test public void whyThisError(@Mocked List<Integer> doNothingWith) { LocalDateTime.now(); Optional<String> any = Arrays.asList("a").stream().findAny(); }
If you comment out LocalDateTime.now() or the mocked List ... no exception occurs
I use openjdk11 and inteliJ as IDE.
Could anybody explain this for me?
Greets
Dennis