### Question:
NatService { public Optional<NatPortMapping> getPortMapping( final NatServiceType serviceType, final NetworkProtocol networkProtocol) { if (isNatEnvironment()) { try { final NatManager natManager = getNatManager().orElseThrow(); return Optional.of(natManager.getPortMapping(serviceType, networkProtocol)); } catch (Exception e) { LOG.warn("Caught exception while trying to query port mapping (ignoring): {}", e); } } return Optional.empty(); } NatService(final Optional<NatManager> natManager, final boolean fallbackEnabled);  NatService(final Optional<NatManager> natManager); boolean isNatEnvironment(); void ifNatEnvironment(
      final NatMethod natMethod, final Consumer<? super NatManager> action); NatMethod getNatMethod(); Optional<NatManager> getNatManager(); void start(); void stop(); String queryExternalIPAddress(final String fallbackValue); String queryLocalIPAddress(final String fallbackValue); Optional<NatPortMapping> getPortMapping(
      final NatServiceType serviceType, final NetworkProtocol networkProtocol); static NatMethod autoDetectNatMethod(final NatMethodDetector... natMethodDetectors);  }### Answer:
@Test public void assertThatGetPortMappingWorksProperlyWithoutNat() { final NatService natService = new NatService(Optional.empty(), true); final Optional<NatPortMapping> portMapping = natService.getPortMapping(NatServiceType.DISCOVERY, NetworkProtocol.TCP); assertThat(portMapping).isNotPresent(); }