### Question:
GraphBuilder { public void buildGraph(BpmnNode rootNode) { this.addNode(rootNode.value()); rootNode.getEdges().forEach(this::addEdge); List<BpmnNode> nodes = rootNode.getChildren(); Deque<BpmnNode> workingSet = new ArrayDeque<>(prioritized(nodes)); Set<BpmnNode> workedOff = new HashSet<>(); while (!workingSet.isEmpty()) { BpmnNode current = workingSet.pop(); if (workedOff.contains(current)) { continue; } workedOff.add(current); workingSet.addAll( prioritized(current.getChildren())); this.addChildNode(current); current.getEdges().forEach(this::addEdge); } } GraphBuilder(
            Graph<DefinitionSet, Node> graph,
            DefinitionManager definitionManager,
            TypedFactoryManager typedFactoryManager,
            RuleManager ruleManager,
            GraphCommandFactory commandFactory,
            GraphCommandManager commandManager); void render(BpmnNode root); void buildGraph(BpmnNode rootNode);  }### Answer:
@Test public void testBoundsCalculation() { double subprocess1X = 10; double subprocess1Y = 10; double subprocess1Width = 100; double subprocess1Height = 200; EmbeddedSubprocess subprocess1Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess1 = mockNode(subprocess1Definition, subprocess1X, subprocess1Y, subprocess1Width, subprocess1Height); when(subprocess1.getUUID()).thenReturn(SUBPROCESS1_ID); BpmnNode subprocess1Node = mockBpmnNode(subprocess1); double subprocess2X = 20; double subprocess2Y = 20; double subprocess2Width = 70; double subprocess2Height = 170; EmbeddedSubprocess subprocess2Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess2 = mockNode(subprocess2Definition, subprocess1X + subprocess2X, subprocess1Y + subprocess2Y, subprocess2Width, subprocess2Height); when(subprocess2.getUUID()).thenReturn(SUBPROCESS2_ID); BpmnNode subprocess2Node = mockBpmnNode(subprocess2); double subprocess3X = 30; double subprocess3Y = 30; double subprocess3Width = 30; double subprocess3Height = 120; EmbeddedSubprocess subprocess3Definition = mock(EmbeddedSubprocess.class); Node<? extends View<? extends BPMNViewDefinition>, ?> subprocess3 = mockNode(subprocess3Definition, subprocess1X + subprocess2X + subprocess3X, subprocess1Y + subprocess2Y + subprocess3Y, subprocess3Width, subprocess3Height); when(subprocess3.getUUID()).thenReturn(SUBPROCESS3_ID); BpmnNode subprocess3Node = mockBpmnNode(subprocess3); Node<? extends View<? extends BPMNViewDefinition>, ?> rootDiagram = mockNode(mock(BPMNDiagramImpl.class), 0, 0, 1000, 1000); when(rootDiagram.getUUID()).thenReturn(DIAGRAM_UUID); BpmnNode rootNode = mockBpmnNode(rootDiagram); subprocess1Node.setParent(rootNode); subprocess2Node.setParent(subprocess1Node); subprocess3Node.setParent(subprocess2Node); graphBuilder.buildGraph(rootNode); assertNodePosition(SUBPROCESS1_ID, subprocess1X, subprocess1Y); assertNodePosition(SUBPROCESS2_ID, subprocess2X, subprocess2Y); assertNodePosition(SUBPROCESS3_ID, subprocess3X, subprocess3Y); }