### Question:
ComposerJsonProcessor { public Payload rewriteProviderJson(final Repository repository, final Payload payload) throws IOException { Map<String, Object> json = parseJson(payload); if (json.get(PACKAGES_KEY) instanceof Map) { Map<String, Object> packagesMap = (Map<String, Object>) json.get(PACKAGES_KEY); for (String packageName : packagesMap.keySet()) { Map<String, Object> packageVersions = (Map<String, Object>) packagesMap.get(packageName); for (String packageVersion : packageVersions.keySet()) { Map<String, Object> versionInfo = (Map<String, Object>) packageVersions.get(packageVersion); versionInfo.remove(SOURCE_KEY); Map<String, Object> distInfo = (Map<String, Object>) versionInfo.get(DIST_KEY); if (distInfo != null && ZIP_TYPE.equals(distInfo.get(TYPE_KEY))) { versionInfo.put(DIST_KEY, buildDistInfo(repository, packageName, packageVersion, (String) distInfo.get(REFERENCE_KEY), (String) distInfo.get(SHASUM_KEY), ZIP_TYPE)); } } } } return new StringPayload(mapper.writeValueAsString(json), payload.getContentType()); } @Inject  ComposerJsonProcessor(final ComposerJsonExtractor composerJsonExtractor); Content generatePackagesFromList(final Repository repository, final Payload payload); Content generatePackagesFromComponents(final Repository repository, final Iterable<Component> components); Payload rewriteProviderJson(final Repository repository, final Payload payload); Content buildProviderJson(final Repository repository,
                                   final StorageTx storageTx,
                                   final Iterable<Component> components); Content mergePackagesJson(final Repository repository, final List<Payload> payloads); Content mergeProviderJson(final Repository repository, final List<Payload> payloads, final DateTime now); String getDistUrl(final String vendor, final String project, final String version, final Payload payload);  }### Answer:
@Test public void rewriteProviderJson() throws Exception { String inputJson = readStreamToString(getClass().getResourceAsStream("rewriteProviderJson.input.json")); String outputJson = readStreamToString(getClass().getResourceAsStream("rewriteProviderJson.output.json")); when(repository.getUrl()).thenReturn("http: when(payload1.openInputStream()).thenReturn(new ByteArrayInputStream(inputJson.getBytes(UTF_8))); ComposerJsonProcessor underTest = new ComposerJsonProcessor(composerJsonExtractor); Payload output = underTest.rewriteProviderJson(repository, payload1); assertEquals(outputJson, readStreamToString(output.openInputStream()), true); }