@Test public void whenIndicatorIsUnknownTheProtocolShouldFailWithAProtocolException() throws Exception { boolean exceptionCatched = false; try { new IndicatorProtocol(messageIo, factory, UNKNOWN_INDICATOR).start(); } catch (final ProtocolException e) { exceptionCatched = true; assertThat(e.getMessage()).contains("indicator").contains("number"); } assertThat(exceptionCatched).as("Expected to catch a protocol exception but didn't.").isTrue(); verifyNoMoreInteractions(messageIo); }
public void start() throws CommunicationException { indicator = factory.newIndicatorByNumber(indicatorNumber).orElseThrow( () -> new ProtocolException("Recieved an request for the indicator with the number " + indicatorNumber + " which is unknown.")); startRequestResponseLoop(); }
IndicatorProtocol { public void start() throws CommunicationException { indicator = factory.newIndicatorByNumber(indicatorNumber).orElseThrow( () -> new ProtocolException("Recieved an request for the indicator with the number " + indicatorNumber + " which is unknown.")); startRequestResponseLoop(); } }
IndicatorProtocol { public void start() throws CommunicationException { indicator = factory.newIndicatorByNumber(indicatorNumber).orElseThrow( () -> new ProtocolException("Recieved an request for the indicator with the number " + indicatorNumber + " which is unknown.")); startRequestResponseLoop(); } IndicatorProtocol(final MessageBasedClientConnection client, final TrendIndicatorFactory factory,
            final int indicatorNumber); }
IndicatorProtocol { public void start() throws CommunicationException { indicator = factory.newIndicatorByNumber(indicatorNumber).orElseThrow( () -> new ProtocolException("Recieved an request for the indicator with the number " + indicatorNumber + " which is unknown.")); startRequestResponseLoop(); } IndicatorProtocol(final MessageBasedClientConnection client, final TrendIndicatorFactory factory,
            final int indicatorNumber); void start(); }
IndicatorProtocol { public void start() throws CommunicationException { indicator = factory.newIndicatorByNumber(indicatorNumber).orElseThrow( () -> new ProtocolException("Recieved an request for the indicator with the number " + indicatorNumber + " which is unknown.")); startRequestResponseLoop(); } IndicatorProtocol(final MessageBasedClientConnection client, final TrendIndicatorFactory factory,
            final int indicatorNumber); void start();  }