S3SchemaUriResolver implements SchemaUriResolver { @VisibleForTesting String newKey(String road, int version) { List<String> elements = new ArrayList<>(); if (StringUtils.isNotBlank(keyPrefix)) { elements.add(keyPrefix); } elements.add("roads"); elements.add(road); elements.add("schemas"); elements.add(Integer.toString(version)); elements.add(road + "_v" + version + ".avsc"); String key = String.join("/", elements); return key; } S3SchemaUriResolver(AmazonS3 s3Client, String bucket, String keyPrefix, boolean enableServerSideEncryption); @VisibleForTesting  S3SchemaUriResolver(
      TransferManager transferManager,
      String uriFormat,
      String bucket,
      String keyPrefix,
      boolean enableServerSideEncryption); @Override URI resolve(Schema schema, String road, int version);  }
@Test public void newKey() { String key = uriResolver.newKey(ROAD, VERSION); assertThat(key, is("prefix/roads/road/schemas/1/road_v1.avsc")); }
@Test public void newKeyNoPrefix() { uriResolver = new S3SchemaUriResolver(transferManager, S3SchemaUriResolver.S3_URI_FORMAT, BUCKET, null, false); String key = uriResolver.newKey(ROAD, VERSION); assertThat(key, is("roads/road/schemas/1/road_v1.avsc")); }