InboundMessageDispatcher implements ResponseMessageHandler { @Override public void handleRecordMessage( Value[] fields ) { if ( log.isDebugEnabled() ) { log.debug( "S: RECORD %s", Arrays.toString( fields ) ); } ResponseHandler handler = handlers.peek(); if ( handler == null ) { throw new IllegalStateException( "No handler exists to handle RECORD message with fields: " + Arrays.toString( fields ) ); } handler.onRecord( fields ); } InboundMessageDispatcher( Channel channel, Logging logging ); void enqueue( ResponseHandler handler ); int queuedHandlersCount(); @Override void handleSuccessMessage( Map<String,Value> meta ); @Override void handleRecordMessage( Value[] fields ); @Override void handleFailureMessage( String code, String message ); @Override void handleIgnoredMessage(); void handleChannelError( Throwable error ); void clearCurrentError(); Throwable currentError(); boolean fatalErrorOccurred();  }
@Test void shouldThrowWhenNoHandlerToHandleRecordMessage() { InboundMessageDispatcher dispatcher = newDispatcher(); assertThrows( IllegalStateException.class, () -> dispatcher.handleRecordMessage( new Value[]{value( 1 ), value( 2 )} ) ); }