NetworkRequestCreator { NetworkRequest createDownloadRequestWithDownloadedBytesHeader(String url, long currentSize, long totalSize) { Map<String, String> headers = new HashMap<>(); String headerValue = String.format(DOWNLOADED_BYTES_VALUE_FORMAT, currentSize, totalSize - 1); headers.put("Range", headerValue); return new LiteNetworkRequest(headers, url, NetworkRequest.Method.GET); }    }
@Test public void createsResumeRequest() { NetworkRequest networkRequest = networkRequestCreator.createDownloadRequestWithDownloadedBytesHeader( "http: 100, 500 ); NetworkRequest expectedNetworkRequest = aNetworkRequest() .withHeader("Range", "bytes=100-499") .withUrl("http: .withMethod(NetworkRequest.Method.GET) .build(); assertThatNetworkRequestsAreEqual(networkRequest, expectedNetworkRequest); }