@Test public void nonExistentRoad() throws Exception { when(roadsMock.get(NON_EXISTENT_ROAD)).thenReturn(null); Optional<Onramp> onramp = underTest.getOnramp(NON_EXISTENT_ROAD); assertFalse(onramp.isPresent()); }
@Override public Optional<Onramp> getOnramp(String name) { return Optional.ofNullable(roads.get(name)).map(road -> new OnrampImpl(metrics, kafkaProducer, road)); }
OnrampServiceImpl implements OnrampService { @Override public Optional<Onramp> getOnramp(String name) { return Optional.ofNullable(roads.get(name)).map(road -> new OnrampImpl(metrics, kafkaProducer, road)); } }
OnrampServiceImpl implements OnrampService { @Override public Optional<Onramp> getOnramp(String name) { return Optional.ofNullable(roads.get(name)).map(road -> new OnrampImpl(metrics, kafkaProducer, road)); } @Autowired  OnrampServiceImpl(
      OnrampMetrics metrics,
      @Value("#{store}") Map<String, Road> roads,
      Producer<byte[], byte[]> kafkaProducer); }
OnrampServiceImpl implements OnrampService { @Override public Optional<Onramp> getOnramp(String name) { return Optional.ofNullable(roads.get(name)).map(road -> new OnrampImpl(metrics, kafkaProducer, road)); } @Autowired  OnrampServiceImpl(
      OnrampMetrics metrics,
      @Value("#{store}") Map<String, Road> roads,
      Producer<byte[], byte[]> kafkaProducer); @Override Optional<Onramp> getOnramp(String name); }
OnrampServiceImpl implements OnrampService { @Override public Optional<Onramp> getOnramp(String name) { return Optional.ofNullable(roads.get(name)).map(road -> new OnrampImpl(metrics, kafkaProducer, road)); } @Autowired  OnrampServiceImpl(
      OnrampMetrics metrics,
      @Value("#{store}") Map<String, Road> roads,
      Producer<byte[], byte[]> kafkaProducer); @Override Optional<Onramp> getOnramp(String name);  }