OnrampImpl extends OnrampTemplate<byte[], byte[]> implements Onramp { @Override public SchemaVersion getSchemaVersion() { Road road = getRoad(); String roadName = road.getName(); return SchemaVersion.latest(road.getSchemas().values()).orElseThrow( () -> new RoadUnavailableException(String.format("Road '%s' has no schema.", roadName))); } OnrampImpl(OnrampMetrics metrics, Producer<byte[], byte[]> kafkaProducer, Road road); @Override SchemaVersion getSchemaVersion();  }
@Test public void getSchemaWithId() { SchemaVersion schemaVersion = underTest.getSchemaVersion(); assertThat(schemaVersion.getSchema(), is(SCHEMA)); assertThat(schemaVersion.getVersion(), is(1)); }
@Test(expected = RoadUnavailableException.class) public void getSchemaWithIdNoSchema() { when(road.getSchemas()).thenReturn(Collections.emptyMap()); underTest.getSchemaVersion(); }