@Test
public void savePropertiesShouldFlushAndCloseWriterEvenOnException() {

    final File filePath = getPathTo("");
    try {
        propertyTools.saveProperties(filePath.getAbsolutePath(), new Properties(), null);
        fail("Should fail to save properties");
    }
    catch (final IOException e) {
        verify(ioTools).flush(nullable(FileWriter.class));
        verify(ioTools).close(nullable(FileWriter.class));
    }
}