@Test
public void builderThrowsIfKeyIsInvalid() throws IOException {

    // given
    expectedException.expect(ConfigurationException.class);
    expectedException.expectMessage(PEMCertInfo.configExceptionMessage);
    File invalidKey = createInvalidKey();
    JKSCertInfo testCertInfo = createTestCertInfoBuilder()
            .withKeystorePath(invalidKey.getAbsolutePath())
            .build();
    // when
    testCertInfo.applyTo(mock(HttpClientConfig.Builder.class));
}