Skip to main content
summaryrefslogtreecommitdiffstats
blob: 23ea56b838a425bd7ed651f7c5b77475ebeabfb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*******************************************************************************
 * Copyright (c) 2015 Tasktop Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.tasks.ui.wizards;

import static org.eclipse.mylyn.internal.tasks.ui.wizards.Messages.SelectRepositoryConnectorPage_Select_a_task_repository_type;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import org.eclipse.mylyn.internal.tasks.ui.ConnectorBrand;
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
import org.junit.Test;

public class NewRepositoryWizardTest {

	@Test
	public void testGetNextPageIWizardPage() {
		NewRepositoryWizard wizard = new NewRepositoryWizard(null);
		wizard.addPages();
		SelectRepositoryConnectorPage page = (SelectRepositoryConnectorPage) wizard.getPage(SelectRepositoryConnectorPage_Select_a_task_repository_type);
		page.setConnectorBrand(new ConnectorBrand(new MockRepositoryConnector(), "org.mylyn"));

		wizard.getNextPage(null);
		assertNull(wizard.getBrand());
		try {
			wizard.getNextPage(page);
		} catch (RuntimeException e) {
			assertTrue(e.getMessage().startsWith("The connector implementation is incomplete"));
		}
		assertEquals("org.mylyn", wizard.getBrand());
	}
}

Back to the top