KafkaStoreSchemaLookup implements SchemaLookup { @Override public Schema getSchema(int version) { return roads.get(roadName).getSchemas().get(version).getSchema(); } @Autowired  KafkaStoreSchemaLookup(Map<String, Road> roads, @Value("${road.name}") String roadName); @Override Schema getSchema(int version);  }
@Test public void getSchema() { schemas.put(1, schemaVersion1); Road road = new Road(schemas); roads.put(ROAD_NAME, road); Schema result = underTest.getSchema(1); assertThat(result, is(schema1)); }
@Test(expected = NullPointerException.class) public void roadHasNoMatchingVersion() { Road road = new Road(schemas); roads.put(ROAD_NAME, road); Schema result = underTest.getSchema(2); assertThat(result, is(schema1)); }