@Test public void loadsDropUrls() throws Exception { String properties = "drop.url=http: "accounting.url=http: "block.url=http: "index.url=http: "crashReport.url=https: InputStream in = new ByteArrayInputStream(properties.getBytes()); LaunchConfigurationReader reader = new LaunchConfigurationReader(in); LaunchConfig config = reader.load(); assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("https: }
public LaunchConfig load() { try { properties.load(propertyStream); String dropUrl = get("drop.url"); String accountingUrl = get("accounting.url"); String blockUrl = get("block.url"); String crashReportUrl = get("crashReport.url"); String indexUrl = get("index.url"); return new LaunchConfig( new URL(dropUrl), new URL(accountingUrl), new URL(blockUrl), new URL(crashReportUrl), new URL(indexUrl) ); } catch (MalformedURLException e) { throw new IllegalStateException("invalid configuration: " + e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException("failed to read properties: " + e.getMessage(), e); } }
LaunchConfigurationReader { public LaunchConfig load() { try { properties.load(propertyStream); String dropUrl = get("drop.url"); String accountingUrl = get("accounting.url"); String blockUrl = get("block.url"); String crashReportUrl = get("crashReport.url"); String indexUrl = get("index.url"); return new LaunchConfig( new URL(dropUrl), new URL(accountingUrl), new URL(blockUrl), new URL(crashReportUrl), new URL(indexUrl) ); } catch (MalformedURLException e) { throw new IllegalStateException("invalid configuration: " + e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException("failed to read properties: " + e.getMessage(), e); } } }
LaunchConfigurationReader { public LaunchConfig load() { try { properties.load(propertyStream); String dropUrl = get("drop.url"); String accountingUrl = get("accounting.url"); String blockUrl = get("block.url"); String crashReportUrl = get("crashReport.url"); String indexUrl = get("index.url"); return new LaunchConfig( new URL(dropUrl), new URL(accountingUrl), new URL(blockUrl), new URL(crashReportUrl), new URL(indexUrl) ); } catch (MalformedURLException e) { throw new IllegalStateException("invalid configuration: " + e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException("failed to read properties: " + e.getMessage(), e); } } LaunchConfigurationReader(InputStream propertyStream); }
LaunchConfigurationReader { public LaunchConfig load() { try { properties.load(propertyStream); String dropUrl = get("drop.url"); String accountingUrl = get("accounting.url"); String blockUrl = get("block.url"); String crashReportUrl = get("crashReport.url"); String indexUrl = get("index.url"); return new LaunchConfig( new URL(dropUrl), new URL(accountingUrl), new URL(blockUrl), new URL(crashReportUrl), new URL(indexUrl) ); } catch (MalformedURLException e) { throw new IllegalStateException("invalid configuration: " + e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException("failed to read properties: " + e.getMessage(), e); } } LaunchConfigurationReader(InputStream propertyStream); LaunchConfig load(); }
LaunchConfigurationReader { public LaunchConfig load() { try { properties.load(propertyStream); String dropUrl = get("drop.url"); String accountingUrl = get("accounting.url"); String blockUrl = get("block.url"); String crashReportUrl = get("crashReport.url"); String indexUrl = get("index.url"); return new LaunchConfig( new URL(dropUrl), new URL(accountingUrl), new URL(blockUrl), new URL(crashReportUrl), new URL(indexUrl) ); } catch (MalformedURLException e) { throw new IllegalStateException("invalid configuration: " + e.getMessage(), e); } catch (IOException e) { throw new IllegalStateException("failed to read properties: " + e.getMessage(), e); } } LaunchConfigurationReader(InputStream propertyStream); LaunchConfig load();  }