SaveAndRenameCommandBuilder { protected CommandWithFileNameAndCommitMessage makeRenameCommand() { return (details) -> { showBusyIndicator(); callRename(details); }; } @Inject  SaveAndRenameCommandBuilder(final RenamePopUpPresenter renamePopUpPresenter,
                                       final BusyIndicatorView busyIndicatorView,
                                       final Event<NotificationEvent> notification,
                                       final Event<RenameInProgressEvent> renameInProgressEvent); SaveAndRenameCommandBuilder<T, M> addValidator(final Validator validator); SaveAndRenameCommandBuilder<T, M> addValidator(final Supplier<Boolean> validator); SaveAndRenameCommandBuilder<T, M> addRenameService(final Caller<? extends SupportsSaveAndRename<T, M>> renameCaller); SaveAndRenameCommandBuilder<T, M> addPathSupplier(final Supplier<Path> pathSupplier); SaveAndRenameCommandBuilder<T, M> addMetadataSupplier(final Supplier<M> metadataSupplier); SaveAndRenameCommandBuilder<T, M> addContentSupplier(final Supplier<T> contentSupplier); SaveAndRenameCommandBuilder<T, M> addIsDirtySupplier(final Supplier<Boolean> isDirtySupplier); SaveAndRenameCommandBuilder<T, M> addSuccessCallback(final ParameterizedCommand<Path> onSuccess); SaveAndRenameCommandBuilder<T, M> addErrorCallback(final Command onError); SaveAndRenameCommandBuilder<T, M> addBeforeSaveAndRenameCommand(final Command beforeSaveAndRenameCommand); Command build();  }
@Test public void testMakeRenameCommand() throws Exception { final String newFileName = "newFileName"; final String commitMessage = "commitMessage"; final FileNameAndCommitMessage message = new FileNameAndCommitMessage(newFileName, commitMessage); doNothing().when(builder).showBusyIndicator(); doReturn(path).when(service).rename(path, newFileName, commitMessage); builder .addRenameService(renameCaller) .addPathSupplier(pathSupplierFake) .makeRenameCommand() .execute(message); final InOrder inOrder = inOrder(builder); inOrder.verify(builder).showBusyIndicator(); inOrder.verify(builder).callRename(message); inOrder.verify(builder).hideRenamePopup(); inOrder.verify(builder).hideBusyIndicator(); inOrder.verify(builder).notifyItemRenamedSuccessfully(); }