Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2015-09-04 18:54:24 -0400
committerGerrit Code Review @ Eclipse.org2015-09-09 14:44:21 -0400
commit95141fe232ccd52b7eff54433996996d4fbcf13b (patch)
tree730ebbcff53c109184f7a1a660189b802a2baf3f /org.eclipse.mylyn.tasks.ui.tests
parentcbd98a2f79e98d0bccff707a7536eeedd376fa3f (diff)
downloadorg.eclipse.mylyn.tasks-95141fe232ccd52b7eff54433996996d4fbcf13b.tar.gz
org.eclipse.mylyn.tasks-95141fe232ccd52b7eff54433996996d4fbcf13b.tar.xz
org.eclipse.mylyn.tasks-95141fe232ccd52b7eff54433996996d4fbcf13b.zip
476680: AbstractRepositorySettingsPage doesn't udpate brand when
specified brand is null Change-Id: I2f003ceba1ea9c5b46adabe301dbd8302eb80fc9 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=476680 Signed-off-by: Jaxsun McCarthy Huggan <jaxsunm@gmail.com>
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