Source:
public void packageNameAcceptanceTest(String packageNameWithVersion, @NpmRepository(repositoryId = REPOSITORY_RELEASES) Repository repository, TestInfo testInfo) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); final String[] packageDetails = packageNameWithVersion.split(":"); final String packageId = packageDetails[0]; final String packageVersion = packageDetails[1]; generatorBasePath = Paths.get(propertiesBooter.getVaultDirectory(), ".temp", testInfo.getTestClass().get().getSimpleName(), testInfo.getTestMethod().get().getName()).toAbsolutePath().normalize(); NpmArtifactGenerator artifactGenerator = new NpmArtifactGenerator(generatorBasePath); Path artifact = artifactGenerator.generateArtifact(packageId, packageVersion); NpmArtifactCoordinates coordinates = NpmArtifactCoordinates.of(packageId, packageVersion); Path publishJsonPath = artifact.resolveSibling("publish.json"); byte[] publishJsonContent = Files.readAllBytes(publishJsonPath); String url = getContextBaseUrl() + "/storages/{storageId}/{repositoryId}/{artifactId}"; mockMvc.contentType(MediaType.APPLICATION_JSON_VALUE) .body(publishJsonContent) .when() .put(url, storageId, repositoryId, coordinates.getId()) .peek() .then() .statusCode(HttpStatus.OK.value()); mockMvc.contentType(MediaType.APPLICATION_JSON_VALUE) .when() .get(url, storageId, repositoryId, coordinates.getId()) .peek() .then() .assertThat() .body("name", equalTo(packageId)) .and() .assertThat() .body("versions." + "'" + packageVersion + "'" +".version", equalTo(packageVersion)) .statusCode(HttpStatus.OK.value()); mockMvc.contentType(MediaType.APPLICATION_JSON_VALUE) .when() .get(url, storageId, repositoryId, coordinates.toResource()) .prettyPeek() .then() .statusCode(HttpStatus.OK.value()) .assertThat() .header(HttpHeaders.CONTENT_LENGTH, equalTo(String.valueOf(Files.size(artifact)))); }

Target:
public void packageNameAcceptanceTest(String packageNameWithVersion, @NpmRepository(repositoryId = REPOSITORY_RELEASES) Repository repository, TestInfo testInfo) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); Path generatorBasePath; final String[] packageDetails = packageNameWithVersion.split(":"); final String packageId = packageDetails[0]; final String packageVersion = packageDetails[1]; generatorBasePath = Paths.get(propertiesBooter.getVaultDirectory(), ".temp", testInfo.getTestClass().get().getSimpleName(), testInfo.getTestMethod().get().getName()).toAbsolutePath().normalize(); NpmArtifactGenerator artifactGenerator = new NpmArtifactGenerator(generatorBasePath); Path artifact = artifactGenerator.generateArtifact(packageId, packageVersion); NpmArtifactCoordinates coordinates = NpmArtifactCoordinates.of(packageId, packageVersion); Path publishJsonPath = artifact.resolveSibling("publish.json"); byte[] publishJsonContent = Files.readAllBytes(publishJsonPath); String url = getContextBaseUrl() + "/storages/{storageId}/{repositoryId}/{artifactId}"; mockMvc.contentType(MediaType.APPLICATION_JSON_VALUE) .body(publishJsonContent) .when() .put(url, storageId, repositoryId, coordinates.getId()) .peek() .then() .statusCode(HttpStatus.OK.value()); mockMvc.contentType(MediaType.APPLICATION_JSON_VALUE) .when() .get(url, storageId, repositoryId, coordinates.getId()) .peek() .then() .assertThat() .body("name", equalTo(packageId)) .and() .assertThat() .body("versions." + "'" + packageVersion + "'" +".version", equalTo(packageVersion)) .statusCode(HttpStatus.OK.value()); mockMvc.contentType(MediaType.APPLICATION_JSON_VALUE) .when() .get(url, storageId, repositoryId, coordinates.toResource()) .prettyPeek() .then() .statusCode(HttpStatus.OK.value()) .assertThat() .header(HttpHeaders.CONTENT_LENGTH, equalTo(String.valueOf(Files.size(artifact)))); }