@Test public void onSubmitCompleteWhenOverwriteFileSelected() { Selection select = mock(Selection.class); FolderNode item = mock(FolderNode.class); StringMap openEditors = mock(StringMap.class); when(selectionAgent.getSelection()).thenReturn(select); when(select.getFirstElement()).thenReturn(item); when(view.isOverwriteFileSelected()).thenReturn(true); when(view.getFileName()).thenReturn("fileName"); when(editorAgent.getOpenedEditors()).thenReturn(openEditors); when(openEditors.getValues()).thenReturn(new JsonArrayListAdapter(new ArrayList())); presenter.onSubmitComplete(""); verify(view).closeDialog(); verify(notificationManager, never()).showError(anyString()); verify(eventBus).fireEvent((Event)anyObject()); }
@Override public void onSubmitComplete(String result) { view.setLoaderVisibility(false); eventBus.fireEvent(new RefreshProjectTreeEvent(getParent())); if (result != null && !result.isEmpty()) { view.closeDialog(); notificationManager.showError(parseMessage(result)); return; } if (view.isOverwriteFileSelected()) { updateOpenedEditors(); } view.closeDialog(); }
UploadFolderFromZipPresenter implements UploadFolderFromZipView.ActionDelegate { @Override public void onSubmitComplete(String result) { view.setLoaderVisibility(false); eventBus.fireEvent(new RefreshProjectTreeEvent(getParent())); if (result != null && !result.isEmpty()) { view.closeDialog(); notificationManager.showError(parseMessage(result)); return; } if (view.isOverwriteFileSelected()) { updateOpenedEditors(); } view.closeDialog(); } }
UploadFolderFromZipPresenter implements UploadFolderFromZipView.ActionDelegate { @Override public void onSubmitComplete(String result) { view.setLoaderVisibility(false); eventBus.fireEvent(new RefreshProjectTreeEvent(getParent())); if (result != null && !result.isEmpty()) { view.closeDialog(); notificationManager.showError(parseMessage(result)); return; } if (view.isOverwriteFileSelected()) { updateOpenedEditors(); } view.closeDialog(); } @Inject  UploadFolderFromZipPresenter(UploadFolderFromZipView view,
                                        @Named("restContext") String restContext,
                                        @Named("workspaceId") String workspaceId,
                                        SelectionAgent selectionAgent,
                                        EditorAgent editorAgent,
                                        EventBus eventBus,
                                        NotificationManager notificationManager); }
UploadFolderFromZipPresenter implements UploadFolderFromZipView.ActionDelegate { @Override public void onSubmitComplete(String result) { view.setLoaderVisibility(false); eventBus.fireEvent(new RefreshProjectTreeEvent(getParent())); if (result != null && !result.isEmpty()) { view.closeDialog(); notificationManager.showError(parseMessage(result)); return; } if (view.isOverwriteFileSelected()) { updateOpenedEditors(); } view.closeDialog(); } @Inject  UploadFolderFromZipPresenter(UploadFolderFromZipView view,
                                        @Named("restContext") String restContext,
                                        @Named("workspaceId") String workspaceId,
                                        SelectionAgent selectionAgent,
                                        EditorAgent editorAgent,
                                        EventBus eventBus,
                                        NotificationManager notificationManager); void showDialog(); @Override void onCancelClicked(); @Override void onSubmitComplete(String result); @Override void onUploadClicked(); @Override void onFileNameChanged(); }
UploadFolderFromZipPresenter implements UploadFolderFromZipView.ActionDelegate { @Override public void onSubmitComplete(String result) { view.setLoaderVisibility(false); eventBus.fireEvent(new RefreshProjectTreeEvent(getParent())); if (result != null && !result.isEmpty()) { view.closeDialog(); notificationManager.showError(parseMessage(result)); return; } if (view.isOverwriteFileSelected()) { updateOpenedEditors(); } view.closeDialog(); } @Inject  UploadFolderFromZipPresenter(UploadFolderFromZipView view,
                                        @Named("restContext") String restContext,
                                        @Named("workspaceId") String workspaceId,
                                        SelectionAgent selectionAgent,
                                        EditorAgent editorAgent,
                                        EventBus eventBus,
                                        NotificationManager notificationManager); void showDialog(); @Override void onCancelClicked(); @Override void onSubmitComplete(String result); @Override void onUploadClicked(); @Override void onFileNameChanged();  }