@@ -0,0 +1,2649 @@
+/*******************************************************************************%0A * Copyright (c) 2012 - 2015 Signal Iduna Corporation and others.%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A * Contributors:%0A * Signal Iduna Corporation - initial API and implementation%0A * akquinet AG%0A *******************************************************************************/%0Apackage org.testeditor.ui.parts.commons;%0A%0Aimport static org.junit.Assert.assertNull;%0Aimport static org.junit.Assert.assertSame;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.eclipse.e4.core.contexts.ContextInjectionFactory;%0Aimport org.eclipse.e4.core.contexts.EclipseContextFactory;%0Aimport org.eclipse.e4.core.contexts.IEclipseContext;%0Aimport org.eclipse.swt.widgets.Shell;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.testeditor.core.model.teststructure.TestCase;%0Aimport org.testeditor.core.model.teststructure.TestProject;%0Aimport org.testeditor.core.services.interfaces.TestProjectService;%0Aimport org.testeditor.ui.adapter.TestProjectServiceAdapter;%0A%0A/**%0A * Tests for the SearchTestStructureDialog.%0A *%0A */%0Apublic class SearchTestStructureDialogTest %7B%0A%0A%09private Shell shell;%0A%0A%09/**%0A%09 * Tests the building of the dialog.%0A%09 * %0A%09 * @throws Exception%0A%09 *             on test failure%0A%09 */%0A%09@Test%0A%09public void testCreateDialogAndFillResultView() throws Exception %7B%0A%09%09IEclipseContext context = EclipseContextFactory.create();%0A%0A%09%09context.set(TestProjectService.class, new TestProjectServiceAdapter() %7B%0A%09%09%09@Override%0A%09%09%09public List%3CTestProject%3E getProjects() %7B%0A%09%09%09%09ArrayList%3CTestProject%3E list = new ArrayList%3CTestProject%3E();%0A%09%09%09%09TestCase testCase = new TestCase();%0A%09%09%09%09TestProject testProject = new TestProject();%0A%09%09%09%09testCase.setName(%22MyTest%22);%0A%09%09%09%09testProject.addChild(testCase);%0A%09%09%09%09list.add(testProject);%0A%09%09%09%09return list;%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09SearchTestStructureDialog dialog = new SearchTestStructureDialog(shell) %7B%0A%09%09%09@Override%0A%09%09%09public Shell getShell() %7B%0A%09%09%09%09return shell;%0A%09%09%09%7D%0A%09%09%7D;%0A%09%09ContextInjectionFactory.inject(dialog, context);%0A%09%09assertNull(dialog.getSelectedTestStructure());%0A%09%09dialog.createDialogArea(shell);%0A%09%09dialog.createTestStructureNamesLoader().run();%0A%09%09assertSame(1, dialog.getResultViewer().getTable().getItemCount());%0A%09%7D%0A%0A%09/**%0A%09 * Creates UI handle for test.%0A%09 */%0A%09@Before%0A%09public void setup() %7B%0A%09%09shell = new Shell();%0A%09%7D%0A%0A%09/**%0A%09 * Cleanup ui handles.%0A%09 */%0A%09@After%0A%09public void teardown() %7B%0A%09%09shell.dispose();%0A%09%7D%0A%7D%0A

Test the Dialog Result view.