Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui.tests')
-rw-r--r--org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizardTest.java61
1 files changed, 52 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizardTest.java b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizardTest.java
index 23ea56b83..2629a16ba 100644
--- a/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizardTest.java
+++ b/org.eclipse.mylyn.tasks.ui.tests/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizardTest.java
@@ -14,28 +14,71 @@ 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.eclipse.mylyn.tasks.tests.connector.MockRepositorySettingsPage;
+import org.junit.Before;
import org.junit.Test;
public class NewRepositoryWizardTest {
+ private NewRepositoryWizard wizard;
+
+ @Before
+ public void setUp() {
+ wizard = new NewRepositoryWizard();
+ wizard.addPages();
+ }
+
@Test
public void testGetNextPageIWizardPage() {
- NewRepositoryWizard wizard = new NewRepositoryWizard(null);
- wizard.addPages();
- SelectRepositoryConnectorPage page = (SelectRepositoryConnectorPage) wizard.getPage(SelectRepositoryConnectorPage_Select_a_task_repository_type);
+ 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"));
- }
+ wizard.getNextPage(page);
assertEquals("org.mylyn", wizard.getBrand());
}
+
+ @Test
+ public void testSetsBrandOnSettingsPage() {
+ MockRepositorySettingsPage settingsPage = navigateWithBrands("org.mylyn");
+ assertEquals("org.mylyn", settingsPage.getBrand());
+ }
+
+ public void testSetsBrandOnSettingsPageNoBrand() {
+ MockRepositorySettingsPage settingsPage = navigateWithBrands((String) null);
+ assertEquals("", settingsPage.getBrand());
+ }
+
+ @Test
+ public void testSetsBrandOnSettingsPageBrandChangeToNull() {
+ MockRepositorySettingsPage settingsPage = navigateWithBrands("org.mylyn", null);
+ assertEquals("", settingsPage.getBrand());
+ }
+
+ @Test
+ public void testSetsBrandOnSettingsPageBrandChangeFromNull() {
+ MockRepositorySettingsPage settingsPage = navigateWithBrands(null, "org.mylyn");
+ assertEquals("org.mylyn", settingsPage.getBrand());
+ }
+
+ @Test
+ public void testSetsBrandOnSettingsPageBrandChange() {
+ MockRepositorySettingsPage settingsPage = navigateWithBrands("org.eclipse", "org.mylyn");
+ assertEquals("org.mylyn", settingsPage.getBrand());
+ }
+
+ private MockRepositorySettingsPage navigateWithBrands(String... brands) {
+ SelectRepositoryConnectorPage selectionPage = (SelectRepositoryConnectorPage) wizard
+ .getPage(SelectRepositoryConnectorPage_Select_a_task_repository_type);
+ for (String brand : brands) {
+ selectionPage.setConnectorBrand(new ConnectorBrand(new MockRepositoryConnector(), brand));
+ wizard.getNextPage(selectionPage);
+ }
+ return (MockRepositorySettingsPage) wizard.getNextPage(selectionPage);
+ }
}

Back to the top