### Question:
LongestPathLayerer implements ILayerer { @Override public int layerGraph(IRegularNode[] acyclicGraph) { IRegularNode[] topologicallySortedNodes = TopologyBuilder.sortGraphByTopology(acyclicGraph); setLayersToOne(topologicallySortedNodes); return determineLayers(topologicallySortedNodes); }  @Override int layerGraph(IRegularNode[] acyclicGraph);  }### Answer:
@Test public void testLayerSingleChild() throws Exception { IRegularNode leaf = NodeFactory.createChildlessNode("leaf"); IRegularNode root = new IdentifiedRegularNode("root", leaf); IRegularNode[] acyclicGraph = new IRegularNode[]{leaf, root}; int deepestLayer = layerer.layerGraph(acyclicGraph); assertEquals(2, deepestLayer); assertEquals(root.getLayer(), 1); assertEquals(leaf.getLayer(), 2); }
@Test public void testLayerDualChild() throws Exception { IRegularNode leaf1 = NodeFactory.createChildlessNode("leaf1"); IRegularNode leaf2 = NodeFactory.createChildlessNode("leaf2"); IRegularNode root = new IdentifiedRegularNode("root", leaf1, leaf2); IRegularNode[] acyclicGraph = new IRegularNode[]{leaf1, leaf2, root}; int deepestLayer = layerer.layerGraph(acyclicGraph); assertEquals(2, deepestLayer); assertEquals(root.getLayer(), 1); assertEquals(leaf1.getLayer(), 2); assertEquals(leaf2.getLayer(), 2); }
@Test public void testLayerDualRootTripleChild() throws Exception { IRegularNode leaf1 = NodeFactory.createChildlessNode("leaf1"); IRegularNode leaf2 = NodeFactory.createChildlessNode("leaf2"); IRegularNode leaf3 = NodeFactory.createChildlessNode("leaf3"); IRegularNode root1 = new IdentifiedRegularNode("root1", leaf1, leaf2, leaf3); IRegularNode root2 = new IdentifiedRegularNode("root2", leaf1, leaf2, leaf3); IRegularNode[] acyclicGraph = new IRegularNode[]{leaf1, leaf2, leaf3, root1, root2}; connect(acyclicGraph); int deepestLayer = layerer.layerGraph(acyclicGraph); assertEquals(2, deepestLayer); assertEquals(root1.getLayer(), 1); assertEquals(root2.getLayer(), 1); assertTrue(leaf1.getLayer() == 2); assertTrue(leaf2.getLayer() == 2); assertTrue(leaf3.getLayer() == 2); }