TollboothSchemaStoreClient implements SchemaStoreClient { @Override public Map<Integer, SchemaVersion> getAllSchemaVersions(String name) throws ServiceException, IllegalArgumentException, UnknownRoadException { checkNotBlank(name, "name"); return Collections.unmodifiableMap(getRoadSchemas(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 public void getAllSchemaVersions() throws Exception { Map<Integer, SchemaVersion> schemas; schemas = client.getAllSchemaVersions("road1"); assertTrue(schemas.isEmpty()); road1.setSchemas(ImmutableMap.of(schemaVersion1.getVersion(), schemaVersion1)); schemas = client.getAllSchemaVersions("road1"); assertThat(schemas.size(), is(1)); assertTrue(schemas.values().contains(schemaVersion1)); }
@Test(expected = UnknownRoadException.class) public void getAllSchemaVersions_fails_when_road_isDeleted() throws Exception { road1.setDeleted(true); client.getAllSchemaVersions("road1"); }