Dropped implements SendingOrDropped { @SuppressWarnings({"rawtypes", "java:S3740"}) @Override public Optional<CompletionStage<CommandResponse>> monitorAndAcknowledge( final ExceptionToAcknowledgementConverter exceptionToAcknowledgementConverter) { final ConnectionMonitor droppedMonitor = sendingContext.getDroppedMonitor(); final OutboundSignal.Mapped outboundSignal = sendingContext.getMappedOutboundSignal(); final GenericTarget genericTarget = sendingContext.getGenericTarget(); droppedMonitor.success(outboundSignal.getSource(), "Signal dropped, target address unresolved: {0}", genericTarget.getAddress()); return Optional.empty(); } Dropped(final SendingContext sendingContext); @SuppressWarnings({"rawtypes", "java:S3740"}) @Override Optional<CompletionStage<CommandResponse>> monitorAndAcknowledge(
            final ExceptionToAcknowledgementConverter exceptionToAcknowledgementConverter);  }
@Test public void monitorAndAcknowledge() { final ConnectionMonitor droppedMonitor = Mockito.mock(ConnectionMonitor.class); final OutboundSignal.Mapped mappedOutboundSignal = Mockito.mock(OutboundSignal.Mapped.class); final Signal source = Mockito.mock(Signal.class); Mockito.when(mappedOutboundSignal.getSource()).thenReturn(source); final GenericTarget genericTarget = Mockito.mock(GenericTarget.class); final String address = "742 Evergreen Terrace"; Mockito.when(genericTarget.getAddress()).thenReturn(address); final SendingContext sendingContext = SendingContext.newBuilder() .mappedOutboundSignal(mappedOutboundSignal) .externalMessage(Mockito.mock(ExternalMessage.class)) .genericTarget(genericTarget) .publishedMonitor(Mockito.mock(ConnectionMonitor.class)) .acknowledgedMonitor(Mockito.mock(ConnectionMonitor.class)) .droppedMonitor(droppedMonitor) .autoAckTarget(Mockito.mock(Target.class)) .build(); final Dropped underTest = new Dropped(sendingContext); final Optional<CompletionStage<CommandResponse>> result = underTest.monitorAndAcknowledge(null); assertThat(result).isEmpty(); Mockito.verify(droppedMonitor).success(source, "Signal dropped, target address unresolved: {0}", address); }