### Question:
ServerTemplatePresenter { public void setup( final ServerTemplate serverTemplate, final ContainerSpec firstContainerSpec ) { view.clear(); this.serverTemplate = serverTemplate; view.setTemplate( serverTemplate.getId(), serverTemplate.getName() ); view.setProcessCapability( serverTemplate.getCapabilities().contains( Capability.PROCESS.toString() ) ); view.setRulesCapability( serverTemplate.getCapabilities().contains( Capability.RULE.toString() ) ); view.setPlanningCapability( serverTemplate.getCapabilities().contains( Capability.PLANNING.toString() ) ); if ( firstContainerSpec != null ) { addContainer( firstContainerSpec ); for ( final ContainerSpec containerSpec : serverTemplate.getContainersSpec() ) { if ( !containerSpec.getId().equals( firstContainerSpec.getId() ) ) { addContainer( containerSpec ); } } containerSpecSelectedEvent.fire( new ContainerSpecSelected( firstContainerSpec ) ); } for ( final ServerInstanceKey serverInstanceKey : serverTemplate.getServerInstanceKeys() ) { addServerInstance( serverInstanceKey ); } } @Inject  ServerTemplatePresenter( final Logger logger,
                                    final View view,
                                    final CopyPopupPresenter copyPresenter,
                                    final Caller<SpecManagementService> specManagementService,
                                    final Event<NotificationEvent> notification,
                                    final Event<AddNewContainer> addNewContainerEvent,
                                    final Event<ContainerSpecSelected> containerSpecSelectedEvent,
                                    final Event<ServerInstanceSelected> serverInstanceSelectedEvent,
                                    final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @PostConstruct void init(); View getView(); ServerTemplate getCurrentServerTemplate(); void setup( final ServerTemplate serverTemplate,
                       final ContainerSpec firstContainerSpec ); void onContainerSelect( @Observes final ContainerSpecSelected containerSpecSelected ); void onServerInstanceSelect( @Observes final ServerInstanceSelected serverInstanceSelected ); void onServerInstanceUpdated( @Observes final ServerInstanceUpdated serverInstanceUpdated ); void onServerInstanceDeleted( @Observes final ServerInstanceDeleted serverInstanceDeleted ); void addNewContainer(); void copyTemplate(); void removeTemplate();  }### Answer:
@Test public void testSetup() { final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "serverTemplateId", "serverName", "serverInstanceId", "url" ); serverTemplate.addServerInstance( serverInstanceKey ); final ReleaseId releaseId = new ReleaseId( "org.kie", "container", "1.0.0" ); final ContainerSpec containerSpec = new ContainerSpec( "containerId", "containerName", serverTemplate, releaseId, KieContainerStatus.CREATING, null ); serverTemplate.addContainerSpec( containerSpec ); final ContainerSpec containerSpec1 = new ContainerSpec( "containerId1", "containerName1", serverTemplate, new ReleaseId( "org.kie", "container2", "1.0.0" ), KieContainerStatus.CREATING, null ); serverTemplate.addContainerSpec( containerSpec1 ); presenter.setup( serverTemplate, containerSpec ); assertEquals( serverTemplate, presenter.getCurrentServerTemplate() ); verify( view ).clear(); verify( view ).setTemplate( serverTemplate.getId(), serverTemplate.getName() ); verify( view ).setProcessCapability( false ); verify( view ).setRulesCapability( false ); verify( view ).setPlanningCapability( false ); verify( view ).addContainer( eq( containerSpec.getServerTemplateKey().getId() ), eq( containerSpec.getId() ), eq( containerSpec.getContainerName() ), any( Command.class ) ); verify( view ).addContainer( eq( containerSpec1.getServerTemplateKey().getId() ), eq( containerSpec1.getId() ), eq( containerSpec1.getContainerName() ), any( Command.class ) ); final ArgumentCaptor<ContainerSpecSelected> selectedCaptor = ArgumentCaptor.forClass( ContainerSpecSelected.class ); verify( containerSpecSelectedEvent ).fire( selectedCaptor.capture() ); assertEquals( containerSpec, selectedCaptor.getValue().getContainerSpecKey() ); verify( view ).addServerInstance( eq( serverInstanceKey.getServerTemplateId() ), eq( serverInstanceKey.getServerInstanceId() ), eq( serverInstanceKey.getServerName() ), any( Command.class ) ); }