diff options
author | sminto | 2010-03-04 18:41:21 +0000 |
---|---|---|
committer | sminto | 2010-03-04 18:41:21 +0000 |
commit | d69a81e052e6005c2a4d16562dcec1004ef7c0b2 (patch) | |
tree | f541668a37baca91874556b8014ad229197d9c54 /org.eclipse.mylyn.tasks.tests | |
parent | 86a87382ef88d402f08ce2ed9454a2c7280ab5bd (diff) | |
download | org.eclipse.mylyn.tasks-d69a81e052e6005c2a4d16562dcec1004ef7c0b2.tar.gz org.eclipse.mylyn.tasks-d69a81e052e6005c2a4d16562dcec1004ef7c0b2.tar.xz org.eclipse.mylyn.tasks-d69a81e052e6005c2a4d16562dcec1004ef7c0b2.zip |
RESOLVED - bug 304694: error reading repositories.xml when repository property has a space in it
https://bugs.eclipse.org/bugs/show_bug.cgi?id=304694
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r-- | org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java | 1 | ||||
-rw-r--r-- | org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java | 79 |
2 files changed, 80 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java index 3154c7a70..c5bbbf7d8 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java @@ -73,6 +73,7 @@ public class AllTasksTests { suite.addTestSuite(TaskExportImportTest.class); suite.addTestSuite(PersonProposalProviderTest.class); suite.addTestSuite(TaskRepositoryLocationTest.class); + suite.addTestSuite(TaskRepositoryTest.class); suite.addTestSuite(AttachmentSizeFormatterTest.class); suite.addTestSuite(TaskMapperTest.class); suite.addTestSuite(TaskListUnmatchedContainerTest.class); diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java new file mode 100644 index 000000000..ba120103e --- /dev/null +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2010 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.tasks.tests.core; + +import junit.framework.TestCase; + +import org.eclipse.mylyn.tasks.core.TaskRepository; + +public class TaskRepositoryTest extends TestCase { + + private TaskRepository taskRepository; + + @Override + protected void setUp() throws Exception { + taskRepository = new TaskRepository("kind", "url"); + } + + public void testSetTaskRepositoryProperty() { + String key = "key"; + String value = "value"; + taskRepository.setProperty(key, value); + assertEquals(value, taskRepository.getProperty(key)); + } + + public void testResetTaskRepositoryProperty() { + String key = "key"; + String value = "value"; + taskRepository.setProperty(key, value); + assertEquals(value, taskRepository.getProperty(key)); + value = "newValue"; + taskRepository.setProperty(key, value); + assertEquals(value, taskRepository.getProperty(key)); + } + + public void testSetTaskRepositoryPropertyWithSpace() { + String key = "key 1"; + String value = "value"; + boolean caughtException = false; + try { + taskRepository.setProperty(key, value); + } catch (IllegalArgumentException e) { + caughtException = true; + } + assertTrue(caughtException); + } + + public void testSetTaskRepositoryPropertyWithTab() { + String key = "key\t1"; + String value = "value"; + boolean caughtException = false; + try { + taskRepository.setProperty(key, value); + } catch (IllegalArgumentException e) { + caughtException = true; + } + assertTrue(caughtException); + } + + public void testSetTaskRepositoryPropertyWithNewline() { + String key = "key\n1"; + String value = "value"; + boolean caughtException = false; + try { + taskRepository.setProperty(key, value); + } catch (IllegalArgumentException e) { + caughtException = true; + } + assertTrue(caughtException); + } +} |