### Question:
GateScript { public static GateScript loadFrom(String name, Properties properties, ClassLoader loader) { if (name == null) { throw new IllegalArgumentException("name must not be null"); } if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } if (loader == null) { throw new IllegalArgumentException("loader must not be null"); } LOG.debug("Restoring WindGate script"); Map<String, Map<String, String>> partitions = partitioning(properties); List<ProcessScript<?>> processes = new ArrayList<>(); for (Map.Entry<String, Map<String, String>> entry : partitions.entrySet()) { LOG.debug("Restoring WindGate process: {}", entry.getKey()); ProcessScript<?> process = loadProcess(entry.getKey(), entry.getValue(), loader); processes.add(process); } return new GateScript(name, processes); } GateScript(String name, List<? extends ProcessScript<?>> processes); String getName(); List<ProcessScript<?>> getProcesses(); static GateScript loadFrom(String name, Properties properties, ClassLoader loader); void storeTo(Properties properties);  }### Answer:
@Test public void loadFrom() { Properties p = new Properties(); p.setProperty(k("test", KEY_DATA_CLASS), String.class.getName()); p.setProperty(k("test", KEY_PROCESS_TYPE), "plain"); p.setProperty(k("test", PREFIX_SOURCE), "ts"); p.setProperty(k("test", PREFIX_DRAIN), "td"); GateScript script = GateScript.loadFrom("testing", p, getClass().getClassLoader()); assertThat(script.getProcesses().size(), is(1)); ProcessScript<?> test = find(script, "test"); assertThat(test.getName(), is("test")); assertThat(test.getProcessType(), is("plain")); assertThat(test.getDataClass(), is((Object) String.class)); assertThat(test.getSourceScript().getResourceName(), is("ts")); assertThat(test.getSourceScript().getConfiguration().keySet(), hasSize(0)); assertThat(test.getSourceScript().getParameterNames(), hasSize(0)); assertThat(test.getDrainScript().getResourceName(), is("td")); assertThat(test.getDrainScript().getConfiguration().keySet(), hasSize(0)); assertThat(test.getDrainScript().getParameterNames(), hasSize(0)); }
@Test(expected = IllegalArgumentException.class) public void loadFrom_missing_dataclass() { Properties p = new Properties(); p.setProperty(k("test", KEY_PROCESS_TYPE), "plain"); p.setProperty(k("test", PREFIX_SOURCE), "ts"); p.setProperty(k("test", PREFIX_DRAIN), "td"); GateScript.loadFrom("testing", p, getClass().getClassLoader()); }
@Test(expected = IllegalArgumentException.class) public void loadFrom_invalid_dataclass() { Properties p = new Properties(); p.setProperty(k("test", KEY_DATA_CLASS), "INVALID-DATA-CLASS"); p.setProperty(k("test", KEY_PROCESS_TYPE), "plain"); p.setProperty(k("test", PREFIX_SOURCE), "ts"); p.setProperty(k("test", PREFIX_DRAIN), "td"); GateScript.loadFrom("testing", p, getClass().getClassLoader()); }