Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/CompareUIPluginTest.java10
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java1
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java26
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchBuilderTest.java2
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java2
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java2
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java15
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StructureCreatorTest.java11
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java33
9 files changed, 102 insertions, 0 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 9439682cc..708a00cb3 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
@@ -30,46 +30,56 @@ import org.eclipse.swt.graphics.Image;
public class CompareUIPluginTest extends TestCase {
private static class UnknownTypedElement implements ITypedElement {
+ @Override
public Image getImage() {
return null;
}
+ @Override
public String getName() {
return "test";
}
+ @Override
public String getType() {
return UNKNOWN_TYPE;
}
}
private static class TextTypedElement implements ITypedElement {
+ @Override
public Image getImage() {
return null;
}
+ @Override
public String getName() {
return "test";
}
+ @Override
public String getType() {
return TEXT_TYPE;
}
}
private static class TextTypedElementStreamAccessor implements ITypedElement, IStreamContentAccessor {
+ @Override
public Image getImage() {
return null;
}
+ @Override
public String getName() {
return "test";
}
+ @Override
public String getType() {
return TEXT_TYPE;
}
+ @Override
public InputStream getContents() throws CoreException {
/*
* Whatever we return has no importance as long as it is not "null", this is only to make
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java
index 092e9be33..1882bbfb6 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DiffTest.java
@@ -44,6 +44,7 @@ public class DiffTest extends TestCase {
super(name);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java
index 50123fb89..4b5046739 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/DocLineComparatorTest.java
@@ -32,10 +32,12 @@ public class DocLineComparatorTest extends TestCase {
super(name);
}
+ @Override
protected void setUp() throws Exception {
// empty
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
@@ -78,20 +80,24 @@ public class DocLineComparatorTest extends TestCase {
ICompareFilter filter = new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(0, 2), new Region(4, 1),
new Region(8, 2) };
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return false;
}
@@ -125,19 +131,23 @@ public class DocLineComparatorTest extends TestCase {
ICompareFilter filter1 = new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(0, 2) };
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return false;
}
@@ -145,19 +155,23 @@ public class DocLineComparatorTest extends TestCase {
ICompareFilter filter2 = new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(4, 1) };
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return false;
}
@@ -165,19 +179,23 @@ public class DocLineComparatorTest extends TestCase {
ICompareFilter filter3 = new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(8, 2) };
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return false;
}
@@ -217,19 +235,23 @@ public class DocLineComparatorTest extends TestCase {
filters[1] = new ICompareFilter[]{
new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(0, 2) };
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return true; // cache-able
}
@@ -239,19 +261,23 @@ public class DocLineComparatorTest extends TestCase {
filters[2] = new ICompareFilter[]{
new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
return new IRegion[] { new Region(0, 2) };
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return false; // not cache-able
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchBuilderTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchBuilderTest.java
index a9d52ed1d..49dbd83be 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchBuilderTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchBuilderTest.java
@@ -34,10 +34,12 @@ public class PatchBuilderTest extends TestCase {
}
+ @Override
protected void setUp() throws Exception {
// Nothing to do
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
index 026e8e433..db032b057 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchTest.java
@@ -48,10 +48,12 @@ public class PatchTest extends TestCase {
defaultPatchProperties.setProperty("fuzzFactor", "-1");
}
+ @Override
protected void setUp() throws Exception {
// empty
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java
index 5b49a3ccb..af8f79534 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUITest.java
@@ -50,6 +50,7 @@ public class PatchUITest extends TestCase {
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
@@ -58,6 +59,7 @@ public class PatchUITest extends TestCase {
testProject.open(null);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
testProject.delete(true, null);
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java
index f2ef14914..ee06b5f0d 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/PatchUtils.java
@@ -46,22 +46,27 @@ public class PatchUtils {
fileName = old;
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
return null;
}
+ @Override
public boolean isReadOnly() {
return false;
}
+ @Override
public String getName() {
return fileName;
}
+ @Override
public IPath getFullPath() {
return null;
}
+ @Override
public InputStream getContents() throws CoreException {
return new BufferedInputStream(asInputStream(fileName));
}
@@ -74,6 +79,7 @@ public class PatchUtils {
this.file = file;
}
+ @Override
public InputStream getContents() throws CoreException {
try {
return new FileInputStream(file);
@@ -83,18 +89,22 @@ public class PatchUtils {
return null;
}
+ @Override
public IPath getFullPath() {
return new Path(file.getAbsolutePath());
}
+ @Override
public String getName() {
return file.getName();
}
+ @Override
public boolean isReadOnly() {
return true;
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
return null;
}
@@ -109,6 +119,7 @@ public class PatchUtils {
this.jarFile = jarFile;
}
+ @Override
public InputStream getContents() throws CoreException {
try {
return jarFile.getInputStream(jarEntry);
@@ -118,18 +129,22 @@ public class PatchUtils {
return null;
}
+ @Override
public IPath getFullPath() {
return new Path(jarFile.getName());
}
+ @Override
public String getName() {
return jarEntry.getName();
}
+ @Override
public boolean isReadOnly() {
return true;
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
return null;
}
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StructureCreatorTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StructureCreatorTest.java
index 09b049059..96d66a35b 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StructureCreatorTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/StructureCreatorTest.java
@@ -81,11 +81,13 @@ public class StructureCreatorTest extends TestCase {
filters[0] = null;
filters[1] = new ICompareFilter[] { new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
String line = lineComparison.get(ICompareFilter.THIS_LINE)
.toString();
@@ -95,10 +97,12 @@ public class StructureCreatorTest extends TestCase {
return null;
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return true; // cache-able
}
@@ -106,11 +110,13 @@ public class StructureCreatorTest extends TestCase {
filters[2] = new ICompareFilter[] { new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor, Object left,
Object right) {
// EMPTY
}
+ @Override
public IRegion[] getFilteredRegions(HashMap lineComparison) {
String line = lineComparison.get(ICompareFilter.THIS_LINE)
.toString();
@@ -120,10 +126,12 @@ public class StructureCreatorTest extends TestCase {
return null;
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return false; // not cache-able
}
@@ -133,10 +141,12 @@ public class StructureCreatorTest extends TestCase {
private Pattern whitespace = Pattern.compile("\\s+");
private Matcher matcher = null;
+ @Override
public String getName() {
return "NAME";
}
+ @Override
public String getContents(Object node, boolean ignoreWhitespace) {
DocumentRangeNode drn = (DocumentRangeNode) node;
String retval = null;
@@ -156,6 +166,7 @@ public class StructureCreatorTest extends TestCase {
return retval;
}
+ @Override
protected IStructureComparator createStructureComparator(
Object element, IDocument document,
ISharedDocumentAdapter sharedDocumentAdapter,
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
index 957dc4ed6..815a0c235 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
@@ -75,12 +75,15 @@ public class TextMergeViewerTest {
}
public static class TestElement implements ITypedElement {
+ @Override
public Image getImage() {
return null;
}
+ @Override
public String getName() {
return "test";
}
+ @Override
public String getType() {
return UNKNOWN_TYPE;
}
@@ -91,9 +94,11 @@ public class TextMergeViewerTest {
* The purpose of the parent is to be able to copy a child into the destination element.
*/
public static class ParentTestElement extends TestElement implements IEditableContent {
+ @Override
public boolean isEditable() {
return false;
}
+ @Override
public ITypedElement replace(ITypedElement child, ITypedElement other) {
if (child == null) { // add child
// clone the other and return it as the new child
@@ -121,6 +126,7 @@ public class TextMergeViewerTest {
}
return child;
}
+ @Override
public void setContent(byte[] newContent) {
// Node is not directly editable
}
@@ -131,25 +137,32 @@ public class TextMergeViewerTest {
public EditableTestElement(byte[] contents) {
this.contents = contents;
}
+ @Override
public String getType() {
return TEXT_TYPE;
}
+ @Override
public InputStream getContents() {
return new ByteArrayInputStream(contents);
}
+ @Override
protected Object clone() {
return new EditableTestElement(contents);
}
+ @Override
public boolean isEditable() {
return true;
}
+ @Override
public ITypedElement replace(ITypedElement dest, ITypedElement src) {
// Nothing to do since this node has no children
return null;
}
+ @Override
public void setContent(byte[] newContent) {
contents = newContent;
}
+ @Override
public boolean equals(Object obj) {
if (obj instanceof EditableTestElement) {
EditableTestElement other = (EditableTestElement) obj;
@@ -171,6 +184,7 @@ public class TextMergeViewerTest {
super(parent, cc);
}
+ @Override
public void copy(boolean leftToRight) {
super.copy(leftToRight);
}
@@ -199,6 +213,7 @@ public class TextMergeViewerTest {
final CompareConfiguration cc) throws Exception {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
Dialog dialog = new Dialog(shell) {
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
viewer = new TestMergeViewer(composite, cc);
@@ -375,12 +390,14 @@ public class TextMergeViewerTest {
Map<String, ICompareFilter> filters = new HashMap<>();
filters.put("filter.id", new ICompareFilter() {
+ @Override
public void setInput(Object input, Object ancestor,
Object left, Object right) {
assertTrue(leftElement == left);
assertTrue(rightElement == right);
}
+ @Override
public IRegion[] getFilteredRegions(
HashMap lineComparison) {
Object thisLine = lineComparison.get(THIS_LINE);
@@ -409,10 +426,12 @@ public class TextMergeViewerTest {
return new IRegion[] { new Region(0, 2) };
}
+ @Override
public boolean isEnabledInitially() {
return false;
}
+ @Override
public boolean canCacheFilteredRegions() {
return true;
}
@@ -436,14 +455,17 @@ public class TextMergeViewerTest {
public void testDocumentAsTypedElement() throws Exception {
class DocumentAsTypedElement extends Document implements ITypedElement {
+ @Override
public String getName() {
return "file";
}
+ @Override
public Image getImage() {
return null;
}
+ @Override
public String getType() {
return ITypedElement.UNKNOWN_TYPE;
}
@@ -463,6 +485,7 @@ public class TextMergeViewerTest {
private void runInDialogWithPartioner(Object input, Runnable runnable, final CompareConfiguration cc) throws Exception {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
Dialog dialog = new Dialog(shell) {
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
viewer = new TestMergeViewerWithPartitioner(composite, cc);
@@ -484,34 +507,42 @@ public class TextMergeViewerTest {
//This viewer is used to provide a dummy partitioner
public static class TestMergeViewerWithPartitioner extends TestMergeViewer {
public class DummyPartitioner implements IDocumentPartitioner {
+ @Override
public void connect(IDocument document) {
//Nothing to do
}
+ @Override
public void disconnect() {
//Nothing to do
}
+ @Override
public void documentAboutToBeChanged(DocumentEvent event) {
//Nothing to do
}
+ @Override
public boolean documentChanged(DocumentEvent event) {
return false;
}
+ @Override
public String[] getLegalContentTypes() {
return null;
}
+ @Override
public String getContentType(int offset) {
return null;
}
+ @Override
public ITypedRegion[] computePartitioning(int offset, int length) {
return null;
}
+ @Override
public ITypedRegion getPartition(int offset) {
return null;
}
@@ -525,9 +556,11 @@ public class TextMergeViewerTest {
super(parent, cc);
}
+ @Override
public void copy(boolean leftToRight) {
super.copy(leftToRight);
}
+ @Override
protected IDocumentPartitioner getDocumentPartitioner() {
return new DummyPartitioner();
}

Back to the top