@Test
public void testFromPlanFile() {

    final File planFile = new File("src/test/resources/OpearFileTest/folders_on_classpath/plan.json");
    Result<AdhocOpear> opearResult = AdhocOpear.fromPlanFile(planFile, null);
    assertFalse("opear should not be a failure", opearResult.isFailure());
    AdhocOpear opear = opearResult.getOrDefault(null);
    assertNotNull("opear is not null", opear);
    assertEquals("expect planFile is referenced by default plan url",
            planFile.getAbsolutePath(),
            Fun.tryOrOptional0(() -> new File(opear.getDefaultPlan().toURI()).getAbsolutePath()).get().orElse(""));
    assertEquals("expect planFile is referenced by specific plan referenced by empty plan name",
            planFile.getAbsolutePath(), opear.getSpecificPlan("")
                    .flatMap(Fun.result1(URL::toURI))
                    .map(Fun.compose1(File::new, File::getAbsolutePath)).getOrDefault(""));
    final ClassLoader parent = getClass().getClassLoader();
    final ClassLoader planCl = opear.getPlanClassLoader(parent);
    assertNotSame("not same classloader", parent, planCl);
    assertSame("expect same parent", parent, planCl.getParent());
    assertTrue("expect instance of URLClassLoader", planCl instanceof URLClassLoader);
    final URL firstUrl = ((URLClassLoader) planCl).getURLs()[0];
    assertEquals("expect planFile parent is referenced by first url",
            planFile.getParentFile().getAbsolutePath(),
            Fun.tryOrOptional0(() -> new File(firstUrl.toURI()).getAbsolutePath()).get().orElse(""));
}