private void buildStreamsJoinThatShouldThrow(final StreamJoined<String, Integer, Integer> streamJoined,
                                                 final JoinWindows joinWindows,
                                                 final String expectedExceptionMessagePrefix) {

        final StreamsBuilder builder = new StreamsBuilder();
        final KStream<String, Integer> left = builder.stream("left", Consumed.with(Serdes.String(), Serdes.Integer()));
        final KStream<String, Integer> right = builder.stream("right", Consumed.with(Serdes.String(), Serdes.Integer()));

        final StreamsException streamsException = assertThrows(
            StreamsException.class,
            () -> left.join(
                right,
                Integer::sum,
                joinWindows,
                streamJoined
            )
        );

        assertTrue(streamsException.getMessage().startsWith(expectedExceptionMessagePrefix));
    }
This test is testing something internal to [[KStreamKStreamJoin]], so we had to setup low-level api manually.
streams/src/test/java/org/apache/kafka/streams/kstream/internals/KStreamKStreamJoinTest.java