### Question:
ProductionBuildAndDeployExecutor extends AbstractBuildAndDeployExecutor { private void buildAndDeploy(final BuildExecutionContext context, final DeploymentMode deploymentMode) { showBuildMessage(); buildServiceCaller.call((RemoteCallback<BuildResults>) buildResults -> onBuildDeploySuccess(context, buildResults), (ErrorCallback<Message>) (message, throwable) -> { onBuildDeployError(context, throwable); return false; }).buildAndDeploy(context.getModule(), deploymentMode); } ProductionBuildAndDeployExecutor(final Caller<BuildService> buildServiceCaller,
                                            final Event<BuildResults> buildResultsEvent,
                                            final Event<NotificationEvent> notificationEvent,
                                            final BuildDialog buildDialog,
                                            final DeploymentPopup deploymentPopup,
                                            final Caller<SpecManagementService> specManagementService,
                                            final ConflictingRepositoriesPopup conflictingRepositoriesPopup);   }### Answer:
@Test public void testBuildAndDeploySingleServerTemplateWithExistingGav() { final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME); serverTemplate.setMode(KieServerMode.PRODUCTION); when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Collections.singletonList(serverTemplate))); when(buildServiceMock.buildAndDeploy(any(Module.class), any(DeploymentMode.class))).thenAnswer(invocationOnMock -> { throw new GAVAlreadyExistsException(); }); runner.run(context); verify(buildDialog).startBuild(); verify(buildDialog).showBusyIndicator(CONSTANTS.Building()); verify(conflictingRepositoriesPopup).show(); }
@Test public void testBuildAndDeploySingleServerTemplateWithException() { final ServerTemplate serverTemplate = new ServerTemplate(SERVER_TEMPLATE_ID, SERVER_TEMPLATE_NAME); serverTemplate.setMode(KieServerMode.PRODUCTION); when(specManagementServiceMock.listServerTemplates()).thenReturn(new ServerTemplateList(Arrays.asList(serverTemplate))); when(buildServiceMock.buildAndDeploy(any(Module.class), any(DeploymentMode.class))).thenAnswer(invocationOnMock -> { throw new Exception(); }); runner.run(context); verify(buildDialog).startBuild(); verify(buildDialog).showBusyIndicator(CONSTANTS.Building()); verify(conflictingRepositoriesPopup, never()).show(); verify(buildDialog).stopBuild(); }