### Question:
ResourceCalculatorProcessTree extends Configured { public static ResourceCalculatorProcessTree getResourceCalculatorProcessTree( String pid, Class<? extends ResourceCalculatorProcessTree> clazz, Configuration conf) { if (clazz != null) { try { Constructor <? extends ResourceCalculatorProcessTree> c = clazz.getConstructor(String.class); ResourceCalculatorProcessTree rctree = c.newInstance(pid); rctree.setConf(conf); return rctree; } catch(Exception e) { throw new RuntimeException(e); } } try { String osName = System.getProperty("os.name"); if (osName.startsWith("Linux")) { return new ProcfsBasedProcessTree(pid); } } catch (SecurityException se) { return null; } return null; } ResourceCalculatorProcessTree(String root); abstract void updateProcessTree(); abstract String getProcessTreeDump(); long getCumulativeVmem(); long getCumulativeRssmem(); abstract long getCumulativeVmem(int olderThanAge); abstract long getCumulativeRssmem(int olderThanAge); abstract long getCumulativeCpuTime(); abstract boolean checkPidPgrpidForMatch(); static ResourceCalculatorProcessTree getResourceCalculatorProcessTree(
    String pid, Class<? extends ResourceCalculatorProcessTree> clazz, Configuration conf);  }### Answer:
@Test public void testCreateInstance() { ResourceCalculatorProcessTree tree; tree = ResourceCalculatorProcessTree.getResourceCalculatorProcessTree("1", EmptyProcessTree.class, new Configuration()); assertNotNull(tree); assertThat(tree, instanceOf(EmptyProcessTree.class)); }
@Test public void testCreatedInstanceConfigured() { ResourceCalculatorProcessTree tree; Configuration conf = new Configuration(); tree = ResourceCalculatorProcessTree.getResourceCalculatorProcessTree("1", EmptyProcessTree.class, conf); assertNotNull(tree); assertThat(tree.getConf(), sameInstance(conf)); }