@Test
void createKeystore_errorWriting() {

    when(fileUtils.getOutputStream(any(File.class))).thenReturn(new OutputStream() {
        @Override
        public void write(int b) throws IOException {
            throw new IOException();
        }
    });
    assertThrows(KeyStoreCreationException.class,
            () -> KeystoreCreator.createKeyStoreIfNecessary(temporaryFolder.getRoot().getPath(), getClass().getClassLoader().getResource("privateKeys").getPath(), singletonList(createPrivateKey()), fileUtils, systemProperties.getPath()));
}