Skip to content

java.lang.IllegalStateException: stream has already been operated upon or closed #573

@Fival85

Description

@Fival85

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions