Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareUIPluginTest.java')
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareUIPluginTest.java35
1 files changed, 21 insertions, 14 deletions
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareUIPluginTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareUIPluginTest.java
index 708a00cb3..f531b7e14 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareUIPluginTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareUIPluginTest.java
@@ -13,21 +13,22 @@
*******************************************************************************/
package org.eclipse.compare.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import junit.framework.TestCase;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.*;
import org.eclipse.compare.internal.CompareUIPlugin;
import org.eclipse.compare.internal.ViewerDescriptor;
import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.graphics.Image;
+import org.junit.Test;
-public class CompareUIPluginTest extends TestCase {
+public class CompareUIPluginTest {
private static class UnknownTypedElement implements ITypedElement {
@Override
@@ -82,43 +83,49 @@ public class CompareUIPluginTest extends TestCase {
@Override
public InputStream getContents() throws CoreException {
/*
- * Whatever we return has no importance as long as it is not "null", this is only to make
- * CompareUIPlugin#guessType happy. However, it is only happy if what we return resembles a text.
+ * Whatever we return has no importance as long as it is not "null", this is
+ * only to make CompareUIPlugin#guessType happy. However, it is only happy if
+ * what we return resembles a text.
*/
- return new ByteArrayInputStream(new byte[] {' '});
+ return new ByteArrayInputStream(new byte[] { ' ' });
}
}
+ @Test
public void testFindContentViewerDescriptor_UnknownType() {
CompareConfiguration cc = new CompareConfiguration();
DiffNode in = new DiffNode(new UnknownTypedElement(), new UnknownTypedElement());
ViewerDescriptor[] result = CompareUIPlugin.getDefault().findContentViewerDescriptor(null, in, cc);
- // API Compatibility : "no descriptor found" should return a null array instead of a 0-lengthed one.
+ // API Compatibility : "no descriptor found" should return a null array instead
+ // of a 0-lengthed one.
assertNull(result);
}
+ @Test
public void testFindContentViewerDescriptor_TextType_NotStreamAccessor() {
CompareConfiguration cc = new CompareConfiguration();
DiffNode in = new DiffNode(new TextTypedElement(), new TextTypedElement());
ViewerDescriptor[] result = CompareUIPlugin.getDefault().findContentViewerDescriptor(null, in, cc);
/*
- * "TextTypedElement" is "text" typed : it thus has a Content Viewer attached. However, this content
- * viewer is currently NOT returned because of bug 293926
+ * "TextTypedElement" is "text" typed : it thus has a Content Viewer attached.
+ * However, this content viewer is currently NOT returned because of bug 293926
*/
assertNotNull(result);
assertEquals(1, result.length);
}
+ @Test
public void testFindContentViewerDescriptorForTextType_StreamAccessor() {
CompareConfiguration cc = new CompareConfiguration();
DiffNode in = new DiffNode(new TextTypedElementStreamAccessor(), new TextTypedElementStreamAccessor());
ViewerDescriptor[] result = CompareUIPlugin.getDefault().findContentViewerDescriptor(null, in, cc);
/*
- * "TextTypedElement" is "text" typed : it thus has a Content Viewer attached. However, the content
- * viewer will only be returned because we made our "ITypedElement" be an IStreamContentAccessor.
+ * "TextTypedElement" is "text" typed : it thus has a Content Viewer attached.
+ * However, the content viewer will only be returned because we made our
+ * "ITypedElement" be an IStreamContentAccessor.
*/
assertNotNull(result);
assertEquals(1, result.length);

Back to the top