containersSpec.add( newContainerFormPresenter.buildContainerSpec( newTemplatePresenter.getTemplateName(), capabilityContainerConfig ) ); return new ServerTemplate( newTemplatePresenter.getTemplateName(), newTemplatePresenter.getTemplateName(), capabilities, capabilityConfig,
@Test public void testTemplateName() { final String templateName = "templateName"; when( view.getTemplateName() ).thenReturn( templateName ); assertEquals( templateName, presenter.getTemplateName() ); verify( view ).getTemplateName(); }
@Test public void testComplete() { when( newTemplatePresenter.isProcessCapabilityChecked() ).thenReturn( true ); when( newContainerFormPresenter.isEmpty() ).thenReturn( true ); when( newContainerFormPresenter.isEmpty() ).thenReturn( true ); when( newTemplatePresenter.getTemplateName() ).thenReturn( "template-name" ); final String successMessage = "SUCCESS"; when( newTemplatePresenterView.getNewServerTemplateWizardSaveSuccess() ).thenReturn( successMessage ); newServerTemplateWizard.complete(); verify( notification ).fire( new NotificationEvent( successMessage, NotificationEvent.NotificationType.SUCCESS ) ); verifyClear(); verify( serverTemplateListRefreshEvent ).fire( new ServerTemplateListRefresh( "template-name" ) ); doThrow( new RuntimeException() ).when( specManagementService ).saveServerTemplate( any( ServerTemplate.class ) ); final String errorMessage = "ERROR"; when( newTemplatePresenterView.getNewServerTemplateWizardSaveError() ).thenReturn( errorMessage ); newServerTemplateWizard.complete(); verify( notification ).fire( new NotificationEvent( errorMessage, NotificationEvent.NotificationType.ERROR ) ); verify( newServerTemplateWizard ).pageSelected( 0 ); verify( newServerTemplateWizard ).start(); verify( newContainerFormPresenter ).initialise(); }