BootstrapConfigPropertyMapper { public static BootstrapConfig fromProperties(Properties bootstrapProperties) { return new BootstrapConfig( new SQLDBConfig(bootstrapProperties.getProperty(BootstrapConfig.SQL_URL), bootstrapProperties.getProperty(BootstrapConfig.SQL_DRIVER), bootstrapProperties.getProperty(BootstrapConfig.SQL_USER), bootstrapProperties.getProperty(BootstrapConfig.SQL_PASSWORD)), ConfigSource.valueOf(bootstrapProperties.getProperty(BootstrapConfig.CONFIG_SOURCE)), bootstrapProperties.getProperty(BootstrapConfig.OSGI_FRAMEWORK_STORAGE), bootstrapProperties.getProperty(BootstrapConfig.MOTECH_DIR), bootstrapProperties.getProperty(BootstrapConfig.QUEUE_URL), getActiveMqProperties(bootstrapProperties)); } private  BootstrapConfigPropertyMapper(); static Properties toProperties(BootstrapConfig bootstrapConfig); static BootstrapConfig fromProperties(Properties bootstrapProperties);  }
@Test public void shouldMapToBootstrapConfigFromProperties() { Properties bootstrapProperties = new Properties(); bootstrapProperties.setProperty(SQL_URL, sqlUrl); bootstrapProperties.setProperty(SQL_DRIVER, sqlDriver); bootstrapProperties.setProperty(SQL_USER, sqlUsername); bootstrapProperties.setProperty(SQL_PASSWORD, sqlPassword); bootstrapProperties.setProperty(CONFIG_SOURCE, configSource.getName()); bootstrapProperties.setProperty(QUEUE_URL, queueUrl); BootstrapConfig bootstrapConfig = BootstrapConfigPropertyMapper.fromProperties(bootstrapProperties); Assert.assertThat(bootstrapConfig.getSqlConfig().getUrl(), Matchers.is(sqlUrl)); Assert.assertThat(bootstrapConfig.getSqlConfig().getUsername(), Matchers.is(sqlUsername)); Assert.assertThat(bootstrapConfig.getSqlConfig().getPassword(), Matchers.is(sqlPassword)); Assert.assertThat(bootstrapConfig.getConfigSource(), is(configSource)); Assert.assertThat(bootstrapConfig.getQueueUrl(), is(queueUrl)); }