### Question:
ProjectMainActions implements ProjectMainActionsView.Presenter,
                                           IsElement { @Override public void onRunTest() { final Optional<Module> activeModule = workspaceProjectContext.getActiveModule(); if (activeModule.isPresent()) { view.showBusyIndicator(ts.getTranslation(LibraryConstants.Testing)); placeManager.goTo(new DefaultPlaceRequest("org.kie.guvnor.TestResults")); testRunnerService.call( (RemoteCallback<Void>) response -> view.hideBusyIndicator() ).runAllTests(user.getIdentifier(), activeModule.get().getRootPath()); } } @Inject  ProjectMainActions(final BuildExecutor buildExecutor,
                              final ProjectMainActionsView view,
                              final Caller<TestRunnerService> testRunnerService,
                              final WorkspaceProjectContext workspaceProjectContext,
                              final PlaceManager placeManager,
                              final TranslationService ts,
                              final User user); @PostConstruct void init(); void setBuildEnabled(boolean buildEnabled); void setDeployEnabled(boolean deployEnabled); void setRedeployEnabled(boolean redeployEnabled); void setViewDeploymentDetailsEnabled(boolean viewDeploymentDetailsEnabled); @Override void triggerBuild(); @Override void triggerBuildAndInstall(); @Override void triggerBuildAndDeploy(); @Override void triggerRedeploy(); @Override void onRunTest(); @Override HTMLElement getElement();  }### Answer:
@Test public void testRunTestNoActiveModule() { doReturn(Optional.empty()).when(workspaceProjectContext).getActiveModule(); presenter.onRunTest(); verify(view, never()).showBusyIndicator(any()); verify(placeManager, never()).goTo(any(PlaceRequest.class)); verify(testRunnerService, never()).runAllTests(anyString(), any()); }
@Test public void testRunTest() { final Module module = mock(Module.class); final Path path = mock(Path.class); doReturn(path).when(module).getRootPath(); doReturn(Optional.of(module)).when(workspaceProjectContext).getActiveModule(); doReturn("mr. Trout").when(user).getIdentifier(); presenter.onRunTest(); verify(view).showBusyIndicator(any()); verify(view).hideBusyIndicator(); verify(placeManager).goTo(placeRequestArgumentCaptor.capture()); verify(testRunnerService).runAllTests("mr. Trout", path); assertEquals("org.kie.guvnor.TestResults", placeRequestArgumentCaptor.getValue().getIdentifier()); }