@Test
public void newConfigurationTest() {

    assertNull(butterflyFacadeImpl.newConfiguration(null).getProperties());
    assertNull(butterflyFacadeImpl.newConfiguration(new Properties()).getProperties());
    try {
        Properties properties = new Properties();
        properties.put("", "v1");
        properties.put(" ", "v2");
        properties.put("a", new Object());
        properties.put("b%", "v4");
        butterflyFacadeImpl.newConfiguration(properties);
        fail("IllegalArgumentException was supposed to be thrown due to invalid properties");
    } catch (IllegalArgumentException e) {
        assertEquals(e.getMessage(), "The following properties are invalid: [ , a, b%]");
    }
    Properties properties = new Properties();
    properties.put("a", "1");
    properties.put("b", "2");
    Configuration c1 = butterflyFacadeImpl.newConfiguration(properties);
    assertEquals(c1.getProperties(), properties);
    assertNull(c1.getOutputFolder());
    assertTrue(c1.isModifyOriginalFolder());
    assertFalse(c1.isZipOutput());
    Configuration c2 = butterflyFacadeImpl.newConfiguration(null, false);
    assertNull(c2.getProperties());
    assertNull(c2.getOutputFolder());
    assertFalse(c2.isModifyOriginalFolder());
    assertFalse(c2.isZipOutput());
    Configuration c3 = butterflyFacadeImpl.newConfiguration(null, true);
    assertNull(c3.getProperties());
    assertNull(c3.getOutputFolder());
    assertFalse(c3.isModifyOriginalFolder());
    assertTrue(c3.isZipOutput());
    File file = new File(".");
    Configuration c4 = butterflyFacadeImpl.newConfiguration(null, file, false);
    assertNull(c4.getProperties());
    assertEquals(c4.getOutputFolder(), file);
    assertFalse(c4.isModifyOriginalFolder());
    assertFalse(c4.isZipOutput());
    Configuration c5 = butterflyFacadeImpl.newConfiguration(null, file, true);
    assertNull(c5.getProperties());
    assertEquals(c5.getOutputFolder(), file);
    assertFalse(c5.isModifyOriginalFolder());
    assertTrue(c5.isZipOutput());
}