TreeLayout { public double getSizeOfLevel(int level) { checkArg(level >= 0, "level must be >= 0"); checkArg(level < getLevelCount(), "level must be < levelCount"); return sizeOfLevel.get(level); } TreeLayout(TreeForTreeLayout<TreeNode> tree,
			NodeExtentProvider<TreeNode> nodeExtentProvider,
			Configuration<TreeNode> configuration, boolean useIdentity);  TreeLayout(TreeForTreeLayout<TreeNode> tree,
			NodeExtentProvider<TreeNode> nodeExtentProvider,
			Configuration<TreeNode> configuration); TreeForTreeLayout<TreeNode> getTree(); NodeExtentProvider<TreeNode> getNodeExtentProvider(); Configuration<TreeNode> getConfiguration(); Rectangle2D getBounds(); int getLevelCount(); double getSizeOfLevel(int level); Map<TreeNode, Rectangle2D.Double> getNodeBounds(); void checkTree(); void dumpTree(PrintStream printStream, DumpConfiguration dumpConfiguration); void dumpTree(PrintStream printStream);  }
@Test public void testGetSizeOfLevel() { StringTreeNode root = createSampleTree_MultiLineNodes(); StringTreeAsTreeForTreeLayout tree = new StringTreeAsTreeForTreeLayout( root); NodeExtentProvider<StringTreeNode> nodeExtentProvider = new MultiLineNodeExtentProvider( 60, 20, 0); DefaultConfiguration<StringTreeNode> config = new DefaultConfiguration<StringTreeNode>( 10, 10); TreeLayout<StringTreeNode> layout = new TreeLayout<StringTreeNode>( tree, nodeExtentProvider, config); assertEquals(2, layout.getLevelCount()); assertEquals(20.0, layout.getSizeOfLevel(0), 0.0); assertEquals(40.0, layout.getSizeOfLevel(1), 0.0); try { layout.getSizeOfLevel(-1); fail("exception expected"); } catch (Exception ex) { assertEquals("level must be >= 0", ex.getMessage()); } try { layout.getSizeOfLevel(2); fail("exception expected"); } catch (Exception ex) { assertEquals("level must be < levelCount", ex.getMessage()); } }