@PrepareForTest({LoggerFactory.class, RestClientFactory.class, RequestSignerImpl.class})

@Test
public void calculateStringToSign_whenDuplicateHeaderKeysExists() {
    final Map<String, List<String>> headers = new HashMap<>();
    headers.put("content-length", Collections.singletonList("238"));
    headers.put("opc-request-id", Lists.newArrayList("ID1", "ID2"));
    try {
        RequestSignerImpl.calculateStringToSign(
                "get", "/path", headers, ImmutableList.of("opc-request-id"), headers);
        fail("Should have thrown");
    } catch (RequestSignerException e) {
        assertEquals("Expecting exactly one value for header opc-request-id", e.getMessage());
    }
}