@Test public void pathSupplierEmpty() { when(road.getPartitionPath()).thenReturn(""); Supplier<Path> supplier = OnrampImpl.pathSupplier(road); assertThat(supplier.get(), is(nullValue())); }
@VisibleForTesting static Supplier<Path> pathSupplier(Road road) { return () -> Optional .ofNullable(road.getPartitionPath()) .filter(p -> !p.isEmpty()) .map(KeyPathParser::parse) .orElse(null); }
OnrampImpl extends OnrampTemplate<byte[], byte[]> implements Onramp { @VisibleForTesting static Supplier<Path> pathSupplier(Road road) { return () -> Optional .ofNullable(road.getPartitionPath()) .filter(p -> !p.isEmpty()) .map(KeyPathParser::parse) .orElse(null); } }
OnrampImpl extends OnrampTemplate<byte[], byte[]> implements Onramp { @VisibleForTesting static Supplier<Path> pathSupplier(Road road) { return () -> Optional .ofNullable(road.getPartitionPath()) .filter(p -> !p.isEmpty()) .map(KeyPathParser::parse) .orElse(null); } OnrampImpl(OnrampMetrics metrics, Producer<byte[], byte[]> kafkaProducer, Road road); }
OnrampImpl extends OnrampTemplate<byte[], byte[]> implements Onramp { @VisibleForTesting static Supplier<Path> pathSupplier(Road road) { return () -> Optional .ofNullable(road.getPartitionPath()) .filter(p -> !p.isEmpty()) .map(KeyPathParser::parse) .orElse(null); } OnrampImpl(OnrampMetrics metrics, Producer<byte[], byte[]> kafkaProducer, Road road); @Override SchemaVersion getSchemaVersion(); }
OnrampImpl extends OnrampTemplate<byte[], byte[]> implements Onramp { @VisibleForTesting static Supplier<Path> pathSupplier(Road road) { return () -> Optional .ofNullable(road.getPartitionPath()) .filter(p -> !p.isEmpty()) .map(KeyPathParser::parse) .orElse(null); } OnrampImpl(OnrampMetrics metrics, Producer<byte[], byte[]> kafkaProducer, Road road); @Override SchemaVersion getSchemaVersion();  }