private Command cancelCommand() { return () -> presenter.cancel(); }
private Command copyCommand() { return () -> presenter.copy(newNameTextBox.getValue()); }
public void show(final Path path, final CommandWithFileNameAndCommitMessage copyPopupCommand) { show(path, defaultValidator(), copyPopupCommand); }
@Override public void copyItem( final Path path, final Validator validator, final CommandWithFileNameAndCommitMessage command ) { copyPopUpPresenter.show( path, validator, command ); } }
@Test public void testShowWithDefaultValidator() throws Exception { presenter.show(path, command); assertNotNull(presenter.getPath()); assertNotNull(presenter.getValidator()); assertNotNull(presenter.getCommand()); verify(view).show(); }
CopyPopUpPresenter.View getCopyView() { return copyPopUpPresenter.getView(); } }
@Test public void testCopy() throws Exception { when(path.getFileName()).thenReturn("file.plugin"); when(toggleCommentPresenter.getComment()).thenReturn("comment"); presenter.show(path, validator, command); presenter.copy("newFile"); verify(validator).validate(eq("newFile.plugin"), any(ValidatorWithReasonCallback.class)); } }
private ToggleCommentPresenter toggleCommentPresenter() { return presenter.getToggleCommentPresenter(); } }
@Override public Path getTargetPath() { if (thereIsAnActiveProject()) { final String path = presenter.getPath().toURI(); final Package selectedPackage = packageListBox.getSelectedPackage(); if (path.contains(ModuleResourcePaths.MAIN_RESOURCES_PATH)) { return selectedPackage.getPackageMainResourcesPath(); } else if (path.contains(ModuleResourcePaths.MAIN_SRC_PATH)) { return selectedPackage.getPackageMainSrcPath(); } else if (path.contains(ModuleResourcePaths.TEST_RESOURCES_PATH)) { return selectedPackage.getPackageTestResourcesPath(); } else if (path.contains(ModuleResourcePaths.TEST_SRC_PATH)) { return selectedPackage.getPackageTestSrcPath(); } } return null; }
private void showCopyPopup(final FolderItem folderItem, final Path path) { copyPopUpPresenter.show(path, new Validator() { @Override
@Test public void testShow() throws Exception { presenter.show(path, validator, command); assertNotNull(presenter.getPath()); assertNotNull(presenter.getValidator()); assertNotNull(presenter.getCommand()); verify(view).show(); }
@Before public void setUp() throws Exception { super.setUp(); when(copyPopUpPresenter.getView()).thenReturn(copyPopUpPresenterView); pathArgumentCaptor = ArgumentCaptor.forClass(Path.class); validatorArgumentCaptor = ArgumentCaptor.forClass(Validator.class); commandWithFileNameArgumentCaptor = ArgumentCaptor.forClass(CommandWithFileNameAndCommitMessage.class); }
@Test public void testCopy() throws Exception { when(path.getFileName()).thenReturn("file.plugin"); when(toggleCommentPresenter.getComment()).thenReturn("comment"); presenter.show(path, validator, command); presenter.copy("newFile"); verify(validator).validate(eq("newFile.plugin"), any(ValidatorWithReasonCallback.class)); } }
public void show(final Path path, final CommandWithFileNameAndCommitMessage copyPopupCommand) { show(path, defaultValidator(), copyPopupCommand); }
private ToggleCommentPresenter toggleCommentPresenter() { return presenter.getToggleCommentPresenter(); } }
void packageListBoxSetup() { final String path = presenter.getPath().toURI(); if (thereIsAnActiveProject() && isAProjectResource(path)) { copyButton().setEnabled(false); packageListBox.setUp(true, () -> copyButton.setEnabled(true)); } }
@Test(expected = IllegalArgumentException.class) public void testShowMissingPath() throws Exception { presenter.show(null, validator, command); }
@Test public void testShow() throws Exception { presenter.show(path, validator, command); assertNotNull(presenter.getPath()); assertNotNull(presenter.getValidator()); assertNotNull(presenter.getCommand()); verify(view).show(); }