ArtifactControllerHelper { private static void handlePartialDownloadWithSingleRange(InputStream is, ByteRange byteRange, HttpServletResponse response) throws IOException { ByteRangeInputStream bris = StreamUtils.findSource(ByteRangeInputStream.class, is); long inputLength = bris != null ? StreamUtils.getLength(bris) : 0; if (byteRange.getOffset() < inputLength) { StreamUtils.setCurrentByteRange(bris, byteRange); prepareResponseBuilderForPartialRequestWithSingleRange(byteRange, inputLength, response); copyToResponse(is, response); } else { setRangeNotSatisfiable(response, inputLength); } } private  ArtifactControllerHelper(); static void handlePartialDownload(InputStream is,
                                             HttpHeaders headers,
                                             HttpServletResponse response); static boolean isRangedRequest(HttpHeaders headers); static void provideArtifactHeaders(HttpServletResponse response,
                                              RepositoryPath path); static final String MULTIPART_BOUNDARY; }
@ExtendWith({ RepositoryManagementTestExecutionListener.class, ArtifactManagementTestExecutionListener.class }) @Test void handlePartialDownloadWithSingleRange(@MavenRepository(repositoryId = REPOSITORY_RELEASES_1) Repository repository, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_1, id = "org.carlspring.strongbox:partial-single", versions = "1.0") Path artifactPath) throws IOException { RepositoryPath artifactRepositoryPath = (RepositoryPath) artifactPath.normalize(); try(InputStream is = artifactResolutionService.getInputStream(artifactRepositoryPath)) { HttpHeaders httpHeaders = getHttpHeaders("100-199"); HttpServletResponse response = new MockHttpServletResponse(); ArtifactControllerHelper.handlePartialDownload(is, httpHeaders, response); assertThat(response.getStatus()).isEqualTo(HttpStatus.PARTIAL_CONTENT.value()); } }