### Question:
CanvasLayoutUtils { public static boolean isCanvasRoot(final Diagram diagram, final Element parent) { return null != parent && isCanvasRoot(diagram, parent.getUUID()); } @Inject  CanvasLayoutUtils(final GraphBoundsIndexer graphBoundsIndexer); static boolean isCanvasRoot(final Diagram diagram,
                                       final Element parent); static boolean isCanvasRoot(final Diagram diagram,
                                       final String pUUID); static int getPaddingX(); static int getPaddingY(); @PreDestroy void destroy(); @SuppressWarnings("unchecked") Point2D getNext(final AbstractCanvasHandler canvasHandler,
                           final Node<View<?>, Edge> root,
                           final Node<View<?>, Edge> newNode); @SuppressWarnings("unchecked") Point2D getNext(final AbstractCanvasHandler canvasHandler,
                           final Node<View<?>, Edge> root,
                           final double rootNodeWidth,
                           final double rootNodeHeight,
                           final double newNodeWidth,
                           final double newNodeHeight,
                           Point2D offset,
                           Point2D rootNodeCoordinates
    ); @SuppressWarnings("unchecked") static Element<? extends Definition<?>> getElement(final AbstractCanvasHandler canvasHandler,
                                                              final String uuid); static void fireElementSelectedEvent(final Event<CanvasSelectionEvent> selectionEvent,
                                                final AbstractCanvasHandler canvasHandler,
                                                final String uuid);  }### Answer:
@Test public void isCanvasRootTrueTest() { when(diagram.getMetadata().getCanvasRootUUID()).thenReturn("canvas_root"); boolean isCanvasRoot = CanvasLayoutUtils.isCanvasRoot(diagram, parentCanvasRoot); assertTrue(isCanvasRoot); }
@Test public void isCanvasRootFalseTest() { when(diagram.getMetadata().getCanvasRootUUID()).thenReturn("test"); boolean isCanvasRoot = CanvasLayoutUtils.isCanvasRoot(diagram, parentNotCanvasRoot); assertFalse(isCanvasRoot); }
@Test public void isCanvasRootWithUuidTrueTest() { when(diagram.getMetadata().getCanvasRootUUID()).thenReturn("canvas_root"); boolean isCanvasRoot = CanvasLayoutUtils.isCanvasRoot(diagram, "canvas_root"); assertTrue(isCanvasRoot); }
@Test public void isCanvasRootWithUuidFalseTest() { when(diagram.getMetadata().getCanvasRootUUID()).thenReturn("test"); boolean isCanvasRoot = CanvasLayoutUtils.isCanvasRoot(diagram, "canvas_root"); assertFalse(isCanvasRoot); }