### Question:
AsakusaProjectProvider implements TestRule { public AsakusaProject newInstance(String name) { if (active.get() == false) { throw new IllegalStateException("provider has not been yet initialized"); } Path base; try { base = temporary.newFolder().toPath(); } catch (IOException e) { throw new IllegalStateException(e); } AtomicInteger counter = new AtomicInteger(); Path project = folder(base, name); Path home = base.resolve(String.format("%s-fw", name)); Supplier<Path> temporaries = () -> folder(base, String.format("%s-tmp%d", name, counter.incrementAndGet())); AsakusaProject result = new AsakusaProject(project, home, temporaries); projectConfigurators.forEach(result::with); result.with(EnvironmentConfigurator.of("ASAKUSA_HOME", home)); return result; }  @Override Statement apply(Statement base, Description description); AsakusaProjectProvider withProvider(Consumer<? super AsakusaProjectProvider> configurator); AsakusaProjectProvider withProject(Consumer<? super AsakusaProject> configurator); AsakusaProject newInstance(String name); static final String PATH_PROPERTIES; }### Answer:
@Test public void simple() { AsakusaProject project = provider.newInstance("testing"); assertThat(String.valueOf(project.getContents().getDirectory().getFileName()), is("testing")); }
@Test public void environment() { String path = System.getenv("PATH"); Assume.assumeNotNull(path); AsakusaProject project = provider.newInstance("testing"); assertThat(project.environment("PATH"), is(path)); }
@Test public void properties() { String version = System.getProperty("java.version"); Assume.assumeNotNull(version); AsakusaProject project = provider.newInstance("testing"); assertThat(project.property("java.version"), is(version)); }
@Test public void load_embed_properties() { AsakusaProject project = provider.newInstance("testing"); assertThat(project.property("asakusafw.version"), is(notNullValue())); }
@Test public void asakusa_home() { AsakusaProject project = provider.newInstance("testing") .with(ContentsConfigurator.copy("src/test/data/home")); assertThat(project.environment("ASAKUSA_HOME"), is(notNullValue())); project.gradle("putHome"); project.withFramework(f -> { assertThat(lines(f.get("output.txt")), contains("OK")); }); }
@Test(expected = RuntimeException.class) public void asakusa_home_nothing() { AsakusaProject project = provider.newInstance("testing"); project.getFramework(); }
@Test public void add_bundle() { AsakusaProject project = provider.newInstance("testing") .with(ContentsConfigurator.copy("src/test/data/bundle")); Bundle bundle = project.addBundle("testing"); project.gradle("putBundle"); assertThat(lines(bundle.get("output.txt")), contains("OK")); }
@Test public void add_bundle_existing() { AsakusaProject project = provider.newInstance("testing") .with(ContentsConfigurator.copy("src/test/data/bundle")); Bundle bundle = project.addBundle("origin"); project.addBundle("testing", bundle.getDirectory()); project.gradle("putBundle"); assertThat(lines(bundle.get("output.txt")), contains("OK")); }