@Test
public void testMergeRequests_withDifferentFields() {

  byte[] data1 = new byte[] {0, 1, 2};
  byte[] data2 = new byte[] {3, 4, 5};
  DownloadRequest request1 =
      new DownloadRequest(
          "id1",
          TYPE_PROGRESSIVE,
          uri1,
          /* streamKeys= */ Collections.emptyList(),
          "key1",
          /* data= */ data1);
  DownloadRequest request2 =
      new DownloadRequest(
          "id1",
          TYPE_PROGRESSIVE,
          uri2,
          /* streamKeys= */ Collections.emptyList(),
          "key2",
          /* data= */ data2);
  // uri, customCacheKey and data should be from the request being merged.
  DownloadRequest mergedRequest = request1.copyWithMergedRequest(request2);
  assertThat(mergedRequest.uri).isEqualTo(uri2);
  assertThat(mergedRequest.customCacheKey).isEqualTo("key2");
  assertThat(mergedRequest.data).isEqualTo(data2);
  mergedRequest = request2.copyWithMergedRequest(request1);
  assertThat(mergedRequest.uri).isEqualTo(uri1);
  assertThat(mergedRequest.customCacheKey).isEqualTo("key1");
  assertThat(mergedRequest.data).isEqualTo(data1);
}