@Test public void testInitializeCheckButtonsCanNotUpdateProject() { doReturn(promises.resolve(true)).when(this.projectController).canUpdateProject(any()); this.emptyAssetsScreen.initialize(); verify(this.view, times(1)).enableAddAssetButton(eq(true)); verify(this.view, times(1)).enableImportButton(eq(true)); }
@PostConstruct public void initialize() { this.view.init(this); projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { this.enableButtons(userCanUpdateProject); newFileUploader.acceptContext(new Callback<Boolean, Void>() { @Override public void onFailure(Void reason) { view.enableImportButton(false); } @Override public void onSuccess(Boolean result) { view.enableImportButton(result && userCanUpdateProject); } }); return promises.resolve(); }); }
EmptyAssetsScreen { @PostConstruct public void initialize() { this.view.init(this); projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { this.enableButtons(userCanUpdateProject); newFileUploader.acceptContext(new Callback<Boolean, Void>() { @Override public void onFailure(Void reason) { view.enableImportButton(false); } @Override public void onSuccess(Boolean result) { view.enableImportButton(result && userCanUpdateProject); } }); return promises.resolve(); }); } }
EmptyAssetsScreen { @PostConstruct public void initialize() { this.view.init(this); projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { this.enableButtons(userCanUpdateProject); newFileUploader.acceptContext(new Callback<Boolean, Void>() { @Override public void onFailure(Void reason) { view.enableImportButton(false); } @Override public void onSuccess(Boolean result) { view.enableImportButton(result && userCanUpdateProject); } }); 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 { @PostConstruct public void initialize() { this.view.init(this); projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { this.enableButtons(userCanUpdateProject); newFileUploader.acceptContext(new Callback<Boolean, Void>() { @Override public void onFailure(Void reason) { view.enableImportButton(false); } @Override public void onSuccess(Boolean result) { view.enableImportButton(result && userCanUpdateProject); } }); 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 { @PostConstruct public void initialize() { this.view.init(this); projectController.canUpdateProject(this.libraryPlaces.getActiveWorkspace()).then(userCanUpdateProject -> { this.enableButtons(userCanUpdateProject); newFileUploader.acceptContext(new Callback<Boolean, Void>() { @Override public void onFailure(Void reason) { view.enableImportButton(false); } @Override public void onSuccess(Boolean result) { view.enableImportButton(result && userCanUpdateProject); } }); 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();  }