Layer implements ILayer { @Override public int getWidth() { int width = 0; for (IVisualizableNode node : nodes) { width = Math.max(width, node.getRightSide()); } return width; } Layer(Area gapDimension, int yPosition); @Override void setPreviousLayer(ILayer previousLayer); @Override boolean isBottomMostLayer(); @Override void addNode(IVisualizableNode node); @Override void positionNodes(); @Override void positionNode(IVisualizableNode node); @Override VisualizableNodes getNodes(); @Override void setNodePosition(IVisualizableNode node, int position); @Override void setNodeOnNextFreePosition(IVisualizableNode node); @Override int getOverlapFreePosition(IVisualizableNode node); @Override Integer getNextNodeLeftExtreme(IVisualizableNode node); @Override IVisualizableNode getNextNode(IVisualizableNode node); @Override void moveNodeTo(IVisualizableNode node, int xPosition); @Override Integer getPreviousNodeRightExtreme(IVisualizableNode node); @Override IVisualizableNode getPreviousNode(IVisualizableNode node); @Override void setFollowUp(ILayer layer); @Override int getYPosition(); @Override int getWidth(); @Override void unrollHorizontalMetanodes(); @Override void shiftRight(int requiredShift); @Override void shiftRightRecursivelyWithThreshold(int threshold, int requiredShift); @Override ILayer getPreviousLayer();  }
@Test public void hasWidth0WithoutNodes() throws Exception { assertThat(layer.getWidth(), is(0)); }