Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ratz2017-05-15 09:44:35 -0400
committerSebastian Ratz2017-05-15 09:47:25 -0400
commit7bb9c4b9505dcded03ed113b35b52afe9fd83bdc (patch)
tree26c6cb7872a457987b5c654b1c99be77d154879b
parent1a3f28dbf5df7c64d31b8e3f2bfeaa70cf06aeda (diff)
downloadeclipse.platform.team-7bb9c4b9505dcded03ed113b35b52afe9fd83bdc.tar.gz
eclipse.platform.team-7bb9c4b9505dcded03ed113b35b52afe9fd83bdc.tar.xz
eclipse.platform.team-7bb9c4b9505dcded03ed113b35b52afe9fd83bdc.zip
Bug 516644 - [regression] Unit test for NPE inI20170515-2000
org.eclipse.team.internal.ui.history.CompareFileRevisionEditorInput.getResource(ICompareInput) Change-Id: I803425df2ded3c98c73988213b9a0ac6becbbc97 Signed-off-by: Sebastian Ratz <sebastian.ratz@sap.com>
-rw-r--r--tests/org.eclipse.compare.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AllTests.java1
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareFileRevisionEditorInputTest.java65
3 files changed, 68 insertions, 1 deletions
diff --git a/tests/org.eclipse.compare.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.compare.tests/META-INF/MANIFEST.MF
index ba007fd78..84b5c456d 100644
--- a/tests/org.eclipse.compare.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.compare.tests/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.junit,
org.eclipse.core.resources,
org.eclipse.core.tests.resources,
org.eclipse.core.tests.harness,
- org.eclipse.core.filesystem
+ org.eclipse.core.filesystem,
+ org.eclipse.team.ui
Bundle-Activator: org.eclipse.compare.tests.CompareTestPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AllTests.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AllTests.java
index 061de77e5..83f2c44cc 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AllTests.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AllTests.java
@@ -37,6 +37,7 @@ public class AllTests {
suite.addTestSuite(RangeDifferencerThreeWayDiffTest.class);
suite.addTestSuite(CompareUIPluginTest.class);
suite.addTestSuite(StructureCreatorTest.class);
+ suite.addTestSuite(CompareFileRevisionEditorInputTest.class);
// $JUnit-END$
return suite;
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareFileRevisionEditorInputTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareFileRevisionEditorInputTest.java
new file mode 100644
index 000000000..9a51c7733
--- /dev/null
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareFileRevisionEditorInputTest.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2017 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.compare.tests;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.team.internal.ui.history.CompareFileRevisionEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+
+import junit.framework.TestCase;
+
+public class CompareFileRevisionEditorInputTest extends TestCase {
+
+ public void testPrepareCompareInputWithNonLocalResourceTypedElements()
+ throws InvocationTargetException, InterruptedException {
+ TestFriendlyCompareFileRevisionEditorInput input = new TestFriendlyCompareFileRevisionEditorInput(
+ new DummyTypedElement(), new DummyTypedElement(), null);
+ input.prepareCompareInput(null);
+ }
+
+ private static class DummyTypedElement implements ITypedElement {
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public Image getImage() {
+ return null;
+ }
+
+ @Override
+ public String getType() {
+ return null;
+ }
+
+ }
+
+ private static class TestFriendlyCompareFileRevisionEditorInput extends CompareFileRevisionEditorInput {
+ public TestFriendlyCompareFileRevisionEditorInput(ITypedElement left, ITypedElement right,
+ IWorkbenchPage page) {
+ super(left, right, page);
+ }
+
+ @Override
+ public ICompareInput prepareCompareInput(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ return super.prepareCompareInput(monitor);
+ }
+ }
+
+}

Back to the top