Iec60870AsduHandlerRegistry { public Iec60870AsduHandler getHandler(final ASduType asduType) throws Iec60870AsduHandlerNotFoundException { if (!this.handlers.containsKey(asduType)) { LOGGER.error("No ASDU handler found for ASDU type {}", asduType); throw new Iec60870AsduHandlerNotFoundException(asduType); } return this.handlers.get(asduType); }  Iec60870AsduHandler getHandler(final ASduType asduType); void registerHandler(final ASduType asduType, final Iec60870AsduHandler handler); void clearHandlers();  }
@Test public void getHandlerShouldThrowExceptionWhenNotPresent() { final ASduType typeId = ASduType.M_ME_TF_1; final Class<?> expected = Iec60870AsduHandlerNotFoundException.class; final Throwable actual = catchThrowable(() -> this.iec60870AsduHandlerRegistry.getHandler(typeId)); assertThat(actual).isInstanceOf(expected); }