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();  }
@Test public void pathSupplier() { when(road.getPartitionPath()).thenReturn("$.a"); Supplier<Path> supplier = OnrampImpl.pathSupplier(road); assertThat(supplier.get(), is(KeyPathParser.parse("$.a"))); }
@Test public void pathSupplierNull() { when(road.getPartitionPath()).thenReturn(null); Supplier<Path> supplier = OnrampImpl.pathSupplier(road); assertThat(supplier.get(), is(nullValue())); }
@Test public void pathSupplierEmpty() { when(road.getPartitionPath()).thenReturn(""); Supplier<Path> supplier = OnrampImpl.pathSupplier(road); assertThat(supplier.get(), is(nullValue())); }