### Question:
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();  }### Answer:
@Test public void testInitializeCheckButtonsCanUpdateProject() { doReturn(promises.resolve(false)).when(this.projectController).canUpdateProject(any()); this.emptyAssetsScreen.initialize(); verify(this.view, times(1)).enableAddAssetButton(eq(false)); verify(this.view, times(1)).enableImportButton(eq(false)); }
@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)); }
@Test public void testInitializeAcceptContentSuccess() { doReturn(promises.resolve(true)).when(this.projectController).canUpdateProject(any()); doAnswer(invocation -> { Callback<Boolean, Void> callback = invocation.getArgumentAt(0, Callback.class); callback.onSuccess(false); return null; }).when(this.newFileUploader).acceptContext(any()); this.emptyAssetsScreen.initialize(); verify(this.view).enableImportButton(eq(true)); verify(this.view).enableImportButton(eq(false)); }
@Test public void testInitializeAcceptContentSuccessWithPermission() { doReturn(promises.resolve(true)).when(this.projectController).canUpdateProject(any()); doAnswer(invocation -> { Callback<Boolean, Void> callback = invocation.getArgumentAt(0, Callback.class); callback.onSuccess(true); return null; }).when(this.newFileUploader).acceptContext(any()); this.emptyAssetsScreen.initialize(); verify(this.view, times(2)).enableImportButton(eq(true)); }
@Test public void testInitializeAcceptContentSuccessWithoutPermission() { doReturn(promises.resolve(false)).when(this.projectController).canUpdateProject(any()); doAnswer(invocation -> { Callback<Boolean, Void> callback = invocation.getArgumentAt(0, Callback.class); callback.onSuccess(true); return null; }).when(this.newFileUploader).acceptContext(any()); this.emptyAssetsScreen.initialize(); verify(this.view, times(2)).enableImportButton(eq(false)); }
@Test public void testInitializeAcceptContentFailure() { doReturn(promises.resolve(true)).when(this.projectController).canUpdateProject(any()); doAnswer(invocation -> { Callback<Boolean, Void> callback = invocation.getArgumentAt(0, Callback.class); callback.onFailure(null); return null; }).when(this.newFileUploader).acceptContext(any()); this.emptyAssetsScreen.initialize(); verify(this.view).enableImportButton(eq(true)); verify(this.view).enableImportButton(eq(false)); }