### Question:
PerformAutomaticLayoutCommand extends AbstractClientSessionCommand<EditorSession> { @Override public <V> void execute(final Callback<V> callback) { final Diagram diagram = getDiagram(); final UndoableLayoutExecutor executor = makeExecutor(); layoutHelper.applyLayout(diagram, executor, true); executeLock(); callback.onSuccess(); } @Inject  PerformAutomaticLayoutCommand(final LayoutHelper layoutHelper,
                                         final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
                                         final Event<LockRequiredEvent> locker); @Override boolean accepts(final ClientSession session); @Override void execute(final Callback<V> callback);  }### Answer:
@Test public void testExecute() { doReturn(diagram).when(command).getDiagram(); doReturn(executor).when(command).makeExecutor(); command.execute(callback); verify(layoutHelper).applyLayout(diagram, executor, true); verify(callback).onSuccess(); verify(command).executeLock(); }