### Question:
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getNewChildGraphIndex(final Node<View<?>, Edge> parent) { if (Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram)) { return parent.getOutEdges().size(); } List<Node<View<?>, Edge>> childNodes = parent.getOutEdges().stream() .map(edge -> (Node<View<?>, Edge>) edge.getTargetNode()) .collect(Collectors.toList()); for (int n = childNodes.size(), i = n - 1; i >= 0; i--) { Node<View<?>, Edge> node = childNodes.get(i); if (isStageNode(node) || node.getContent().getDefinition() instanceof StartNoneEvent) { return i + 1; } } return 0; }  @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
                                         final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
                                          final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent);  }### Answer:
@Test public void testGetGraphNewChildIndex_withStage() { setupForStage(); assertEquals(2, CaseManagementCommandUtil.getNewChildGraphIndex(parent)); }
@Test public void testGetGraphNewChildIndex_withSubStage() { setupForSubStage(); assertEquals(2, CaseManagementCommandUtil.getNewChildGraphIndex(parent)); }