### Question:
LayoutHelper { public void applyLayout(final Diagram diagram, final LayoutExecutor layoutExecutor) { applyLayout(diagram, layoutExecutor, false); } @Inject  LayoutHelper(final LayoutService layoutService); void applyLayout(final Diagram diagram, final LayoutExecutor layoutExecutor); void applyLayout(final Diagram diagram,
                            final LayoutExecutor layoutExecutor,
                            final boolean overrideCurrentLayout); LayoutService getLayoutService();  }### Answer:
@Test public void applyLayout() { final LayoutHelper helper = new LayoutHelper(layoutService); helper.applyLayout(diagram, layoutExecutor); verify(rootNodeContent).setBounds(argumentCaptor.capture()); final Bounds bounds = argumentCaptor.getValue(); isCloseToZero(bounds.getLowerRight()); isCloseToZero(bounds.getUpperLeft()); }
@Test public void applyLayoutDoNotOverrideExistingLayout() { when(layoutService.hasLayoutInformation(graph)).thenReturn(true); final LayoutHelper helper = new LayoutHelper(layoutService); helper.applyLayout(diagram, layoutExecutor, false); verify(layoutExecutor, never()).applyLayout(any(), any()); }
@Test public void applyLayoutOverrideExistingLayout() { when(layoutService.hasLayoutInformation(graph)).thenReturn(true); final LayoutHelper helper = new LayoutHelper(layoutService); helper.applyLayout(diagram, layoutExecutor, true); verify(layoutExecutor).applyLayout(any(), any()); }