TollboothSchemaStoreClient implements SchemaStoreClient { @Override public void deleteSchemaVersion(String name, int version) throws UnknownRoadException { Optional.of(getRoad(name)).map(Road::getSchemas).map(m -> m.get(version)).ifPresent(markSchemaAsDeleted(name)); } @Autowired  TollboothSchemaStoreClient(@Value("#{store}") Map<String, Road> store, PatchSetEmitter modificationEmitter); @Override Optional<SchemaVersion> getSchema(String name, int version); @Override Optional<SchemaVersion> getActiveSchema(String name, int version); @Override Optional<SchemaVersion> getLatestActiveSchema(String name); @Override SchemaVersion registerSchema(String name, Schema schema); @Override SchemaVersion registerSchema(String name, Schema schema, int version); @Override Map<Integer, SchemaVersion> getAllSchemaVersions(String name); @Override Map<Integer, SchemaVersion> getActiveSchemaVersions(String name); @Override void deleteSchemaVersion(String name, int version);  }
@Test(expected = UnknownRoadException.class) public void deleteSchemaForRoadThatDoesNotExist() throws Exception { client.deleteSchemaVersion("not-exist", 1); }
@Test(expected = UnknownRoadException.class) public void deleteSchema_fails_when_road_isDeleted() throws Exception { road1.setDeleted(true); client.deleteSchemaVersion("road1", 1); }