diff options
author | Steffen Pingel | 2013-04-02 10:53:55 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2013-04-04 22:09:15 +0000 |
commit | 13588971667d0529469d4d5c448291029280d6c5 (patch) | |
tree | 160a67c41fdf3acf4ed9121e8dfb672a23944e87 /org.eclipse.mylyn.tasks.core.tests/src | |
parent | 5ffbeddd762a2aebc1f02e74bdbecd02bdf29bdb (diff) | |
download | org.eclipse.mylyn.tasks-13588971667d0529469d4d5c448291029280d6c5.tar.gz org.eclipse.mylyn.tasks-13588971667d0529469d4d5c448291029280d6c5.tar.xz org.eclipse.mylyn.tasks-13588971667d0529469d4d5c448291029280d6c5.zip |
404711: TaskAttachmentPartSource swallows source exception
Change-Id: I285cfdd5f0bfb569524001c3af3838fe5a2ef5e0
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404711
Diffstat (limited to 'org.eclipse.mylyn.tasks.core.tests/src')
-rw-r--r-- | org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentPartSourceTest.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentPartSourceTest.java b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentPartSourceTest.java new file mode 100644 index 000000000..c9d2d4643 --- /dev/null +++ b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentPartSourceTest.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2013 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.core.data; + +import static org.junit.Assert.assertSame; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.InputStream; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.mylyn.internal.tasks.core.data.TextTaskAttachmentSource; +import org.junit.Test; + +/** + * @author Steffen Pingel + */ +public class TaskAttachmentPartSourceTest { + + @Test + public void testCreateInputStream_Exception() { + final CoreException exception = new CoreException(Status.OK_STATUS); + AbstractTaskAttachmentSource source = new TextTaskAttachmentSource("content") { + @Override + public InputStream createInputStream(IProgressMonitor monitor) throws CoreException { + throw exception; + } + }; + TaskAttachmentPartSource partSource = new TaskAttachmentPartSource(source, "filename"); + try { + partSource.createInputStream(); + fail("Expected IOException"); + } catch (IOException e) { + assertSame(exception, e.getCause()); + } + } + +} |