### Question:
PropertyConfigurator implements Consumer<BaseProject<?>> { public static PropertyConfigurator of(String key, String value) { return of(Collections.singletonMap(key, value)); } PropertyConfigurator(Map<String, String> edit); static PropertyConfigurator nothing(); static PropertyConfigurator system(); static PropertyConfigurator of(String key, String value); static PropertyConfigurator of(String key, Path path); static PropertyConfigurator of(Map<String, String> properties); static PropertyConfigurator of(Properties properties); static PropertyConfigurator of(URL resource); static PropertyConfigurator of(Optional<? extends URL> resource); static PropertyConfigurator of(Enumeration<? extends URL> resources); @Override void accept(BaseProject<?> project);  }### Answer:
@Test public void of_pair() { BasicProject project = project() .with(PropertyConfigurator.of("TESTING", "OK")); assertThat(project.property("TESTING"), is("OK")); project.with(PropertyConfigurator.of("TESTING", (String) null)); assertThat(project.property("TESTING"), is(nullValue())); }
@Test public void of_path() throws IOException { Path path = Paths.get("src/main/java"); BasicProject project = project() .with(PropertyConfigurator.of("TESTING", path)); assertThat( Files.isSameFile(path, Paths.get(project.property("TESTING"))), is(true)); }
@Test public void of_map() throws IOException { Map<String, String> vars = new LinkedHashMap<>(); vars.put("A", "1"); vars.put("B", "2"); vars.put("C", "3"); BasicProject project = project() .with(PropertyConfigurator.of(vars)); assertThat(project.property("A"), is("1")); assertThat(project.property("B"), is("2")); assertThat(project.property("C"), is("3")); assertThat(project.property("D"), is(nullValue())); Map<String, String> patch = new LinkedHashMap<>(); patch.put("B", "4"); patch.put("C", null); patch.put("D", "5"); project.with(PropertyConfigurator.of(patch)); assertThat(project.property("A"), is("1")); assertThat(project.property("B"), is("4")); assertThat(project.property("C"), is(nullValue())); assertThat(project.property("D"), is("5")); }
@Test public void of_url() { BasicProject project = project() .with(PropertyConfigurator.of(resource("a"))); assertThat(project.property("a"), is("1")); }
@Test public void of_url_optional() { BasicProject project = project() .with(PropertyConfigurator.of(Optional.empty())); assertThat(project.properties().keySet(), hasSize(0)); project.with(PropertyConfigurator.of(Optional.of(resource("a")))); assertThat(project.property("a"), is("1")); }
@Test public void of_url_enum() { BasicProject project = project() .with(PropertyConfigurator.of(Collections.enumeration(Arrays.asList( resource("a"), resource("b"), resource("c"), resource("b-override"))))); assertThat(project.property("a"), is("1")); assertThat(project.property("b"), is("-")); assertThat(project.property("c"), is("3")); }