@Test public void testAddAsset() { { doReturn(promises.resolve(false)).when(this.projectController).canUpdateProject(any()); this.emptyAssetsScreen.addAsset(); verify(this.libraryPlaces, never()).goToAddAsset(); } { doReturn(promises.resolve(true)).when(this.projectController).canUpdateProject(any()); this.emptyAssetsScreen.addAsset(); verify(this.libraryPlaces, times(1)).goToAddAsset(); } }
public void addAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { this.libraryPlaces.goToAddAsset(); } return promises.resolve(); }); }
EmptyAssetsScreen { public void addAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { this.libraryPlaces.goToAddAsset(); } return promises.resolve(); }); } }
EmptyAssetsScreen { public void addAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { this.libraryPlaces.goToAddAsset(); } 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 addAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { this.libraryPlaces.goToAddAsset(); } 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 addAsset() { projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { if (userCanUpdateProject) { this.libraryPlaces.goToAddAsset(); } 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();  }