void (@NotNull GenericType producerAfterType, GenericType @NotNull ... intermediateAfterTypes) { final PsiElement elementAtCaret = configureAndGetElementAtCaret(); assertNotNull(elementAtCaret); final List<StreamChain> chains = getChainBuilder().build(elementAtCaret); assertFalse(chains.isEmpty()); final StreamChain chain = chains.get(0); final List<IntermediateStreamCall> intermediateCalls = chain.getIntermediateCalls(); assertEquals(intermediateAfterTypes.length, intermediateCalls.size()); assertEquals(producerAfterType, chain.getQualifierExpression().getTypeAfter()); if (intermediateAfterTypes.length > 0) { assertEquals(producerAfterType, intermediateCalls.get(0).getTypeBefore()); for (int i = 0; i < intermediateAfterTypes.length - 1; i++) { assertEquals(intermediateAfterTypes[i], intermediateCalls.get(i).getTypeAfter()); assertEquals(intermediateAfterTypes[i], intermediateCalls.get(i + 1).getTypeBefore()); } final GenericType lastAfterType = intermediateAfterTypes[intermediateAfterTypes.length - 1]; assertEquals(lastAfterType, chain.getTerminationCall().getTypeBefore()); final IntermediateStreamCall lastCall = intermediateCalls.get(intermediateCalls.size() - 1); assertEquals(lastAfterType, lastCall.getTypeAfter()); } else { assertEquals(producerAfterType, chain.getTerminationCall().getTypeBefore()); } }