@Test
public void withAdditionalHeaders_setsCorrectHeaders() {

  Map<String, String> httpRequestProperties = createRequestProperties(5);
  DataSpec dataSpec = createDataSpecWithHeaders(httpRequestProperties);
  Map<String, String> additionalHeaders = createRequestProperties(5, 10);
  // additionalHeaders may overwrite a header key
  String existingKey = httpRequestProperties.keySet().iterator().next();
  additionalHeaders.put(existingKey, "overwritten");
  Map<String, String> expectedHeaders = new HashMap<>(httpRequestProperties);
  expectedHeaders.putAll(additionalHeaders);
  DataSpec dataSpecCopy = dataSpec.withAdditionalHeaders(additionalHeaders);
  assertThat(dataSpecCopy.httpRequestHeaders).isEqualTo(expectedHeaders);
}