void (@NotNull ResolvedStreamChain chain) { final List<ResolvedStreamCall.Intermediate> intermediates = chain.getIntermediateCalls(); final ResolvedStreamCall.Terminator terminator = chain.getTerminator(); if (intermediates.isEmpty()) { assertFalse(terminator.getStateBefore() instanceof PrevAwareState); } checkIntermediates(chain.getIntermediateCalls()); assertEquals(terminator.getCall().getName(), terminator.getStateBefore().getNextCall().getName()); final PrevAwareState after = terminator.getStateAfter(); if (after != null) { final StreamCall terminatorCall = after.getPrevCall(); assertNotNull(terminatorCall); assertEquals(terminator.getCall().getName(), terminatorCall.getName()); } if (!intermediates.isEmpty()) { final ResolvedStreamCall.Intermediate lastIntermediate = intermediates.get(intermediates.size() - 1); final PrevAwareState stateAfterIntermediates = lastIntermediate.getStateAfter(); assertInstanceOf(stateAfterIntermediates, NextAwareState.class); assertEquals(terminator.getCall().getName(), ((NextAwareState)stateAfterIntermediates).getNextCall().getName()); } }