@Test public void testImportAsset() { { doReturn(promises.resolve(false)).when(this.projectController).canUpdateProject(any()); this.emptyAssetsScreen.importAsset(); verify(this.newFileUploader, never()).getCommand(any()); } { doReturn(promises.resolve(true)).when(this.projectController).canUpdateProject(any()); this.emptyAssetsScreen.importAsset(); verify(this.newFileUploader, times(1)).getCommand(any()); } }
public void importAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { newFileUploader.getCommand(newResourcePresenter).execute(); } return promises.resolve(); }); }
EmptyAssetsScreen { public void importAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { newFileUploader.getCommand(newResourcePresenter).execute(); } return promises.resolve(); }); } }
EmptyAssetsScreen { public void importAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { newFileUploader.getCommand(newResourcePresenter).execute(); } return promises.resolve(); }); } @Inject  EmptyAssetsScreen(final EmptyAssetsScreen.View view,
                             final NewFileUploader newFileUploader,
                             final NewResourcePresenter newResourcePresenter,
                             final ProjectController projectController,
                             final LibraryPlaces libraryPlaces,
                             final Promises promises); }
EmptyAssetsScreen { public void importAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { newFileUploader.getCommand(newResourcePresenter).execute(); } return promises.resolve(); }); } @Inject  EmptyAssetsScreen(final EmptyAssetsScreen.View view,
                             final NewFileUploader newFileUploader,
                             final NewResourcePresenter newResourcePresenter,
                             final ProjectController projectController,
                             final LibraryPlaces libraryPlaces,
                             final Promises promises); @PostConstruct void initialize(); void importAsset(); void addAsset(); EmptyAssetsScreen.View getView(); }
EmptyAssetsScreen { public void importAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { newFileUploader.getCommand(newResourcePresenter).execute(); } return promises.resolve(); }); } @Inject  EmptyAssetsScreen(final EmptyAssetsScreen.View view,
                             final NewFileUploader newFileUploader,
                             final NewResourcePresenter newResourcePresenter,
                             final ProjectController projectController,
                             final LibraryPlaces libraryPlaces,
                             final Promises promises); @PostConstruct void initialize(); void importAsset(); void addAsset(); EmptyAssetsScreen.View getView();  }