Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2015-11-30 14:23:22 -0500
committerMarkus Keller2015-12-01 07:59:16 -0500
commit96da92a20589d62dad534245c5d9c4d45618ee95 (patch)
treedb7f27dc0839db136db463ad28a7e763a6a07a91 /org.eclipse.search.tests
parent0bbe21e0e553957dd09eda0b29e8c77a98f38048 (diff)
downloadeclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.tar.gz
eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.tar.xz
eclipse.platform.text-96da92a20589d62dad534245c5d9c4d45618ee95.zip
Diffstat (limited to 'org.eclipse.search.tests')
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java6
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java18
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java6
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/LineAnnotationManagerTest.java6
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/SortingTest.java15
5 files changed, 25 insertions, 26 deletions
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
index b227e8daf..160ac8fe9 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/FileTool.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -50,11 +50,11 @@ public class FileTool {
* @throws IOException in case of problem
*/
public static void unzip(ZipFile zipFile, File dstDir) throws IOException {
- Enumeration entries = zipFile.entries();
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
try {
while(entries.hasMoreElements()){
- ZipEntry entry = (ZipEntry)entries.nextElement();
+ ZipEntry entry = entries.nextElement();
if(entry.isDirectory()){
continue;
}
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java
index e7e8856a3..1c98bdb66 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java
@@ -97,9 +97,9 @@ public class AnnotationManagerTest extends TestCase {
ITextEditor editor= (ITextEditor)SearchTestPlugin.openTextEditor(SearchPlugin.getActivePage(), file);
IAnnotationModel annotationModel= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
annotationModel.getAnnotationIterator();
- HashSet positions= new HashSet();
- for (Iterator iter= annotationModel.getAnnotationIterator(); iter.hasNext();) {
- Annotation annotation= (Annotation) iter.next();
+ HashSet<Position> positions= new HashSet<>();
+ for (Iterator<Annotation> iter= annotationModel.getAnnotationIterator(); iter.hasNext();) {
+ Annotation annotation= iter.next();
if (annotation.getType().equals(fAnnotationTypeLookup.getAnnotationType(NewSearchUI.SEARCH_MARKER, IMarker.SEVERITY_INFO))) {
positions.add(annotationModel.getPosition(annotation));
}
@@ -138,8 +138,8 @@ public class AnnotationManagerTest extends TestCase {
ITextEditor editor= (ITextEditor)SearchTestPlugin.openTextEditor(SearchPlugin.getActivePage(), file);
IAnnotationModel annotationModel= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
int annotationCount= 0;
- for (Iterator annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
- Annotation annotation= (Annotation) annotations.next();
+ for (Iterator<Annotation> annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
+ Annotation annotation= annotations.next();
if (annotation.getType().equals(fAnnotationTypeLookup.getAnnotationType(NewSearchUI.SEARCH_MARKER, IMarker.SEVERITY_INFO))) {
annotationCount++;
}
@@ -164,8 +164,8 @@ public class AnnotationManagerTest extends TestCase {
IAnnotationModel annotationModel= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
int annotationCount= 0;
IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
- for (Iterator annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
- Annotation annotation= (Annotation) annotations.next();
+ for (Iterator<Annotation> annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
+ Annotation annotation= annotations.next();
if (annotation.getType().equals(fAnnotationTypeLookup.getAnnotationType(NewSearchUI.SEARCH_MARKER, IMarker.SEVERITY_INFO))) {
Position p= annotationModel.getPosition(annotation);
String text= document.get(p.getOffset(), p.getLength());
@@ -192,8 +192,8 @@ public class AnnotationManagerTest extends TestCase {
IAnnotationModel annotationModel= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
int annotationCount= 0;
IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
- for (Iterator annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
- Annotation annotation= (Annotation) annotations.next();
+ for (Iterator<Annotation> annotations= annotationModel.getAnnotationIterator(); annotations.hasNext();) {
+ Annotation annotation= annotations.next();
if (annotation.getType().equals(fAnnotationTypeLookup.getAnnotationType(NewSearchUI.SEARCH_MARKER, IMarker.SEVERITY_INFO))) {
Position p= annotationModel.getPosition(annotation);
String text= document.get(p.getOffset(), p.getLength());
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java
index 097516ace..86e76d62b 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/FileSearchTests.java
@@ -55,14 +55,14 @@ public class FileSearchTests extends TestCase {
private static class TestResultCollector extends TextSearchRequestor {
- protected List fResult;
+ protected List<TestResult> fResult;
public TestResultCollector() {
reset();
}
public TestResult[] getResults() {
- return (TestResult[]) fResult.toArray(new TestResult[fResult.size()]);
+ return fResult.toArray(new TestResult[fResult.size()]);
}
public int getNumberOfResults() {
@@ -70,7 +70,7 @@ public class FileSearchTests extends TestCase {
}
public void reset() {
- fResult= new ArrayList();
+ fResult= new ArrayList<>();
}
}
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/LineAnnotationManagerTest.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/LineAnnotationManagerTest.java
index efc1708de..78896fe4e 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/LineAnnotationManagerTest.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/LineAnnotationManagerTest.java
@@ -94,9 +94,9 @@ public class LineAnnotationManagerTest extends TestCase {
IAnnotationModel annotationModel= editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
IDocument document= editor.getDocumentProvider().getDocument(editor.getEditorInput());
annotationModel.getAnnotationIterator();
- ArrayList positions= new ArrayList();
- for (Iterator iter= annotationModel.getAnnotationIterator(); iter.hasNext();) {
- Annotation annotation= (Annotation) iter.next();
+ ArrayList<Position> positions= new ArrayList<>();
+ for (Iterator<Annotation> iter= annotationModel.getAnnotationIterator(); iter.hasNext();) {
+ Annotation annotation= iter.next();
if (annotation.getType().equals(fAnnotationTypeLookup.getAnnotationType(NewSearchUI.SEARCH_MARKER, IMarker.SEVERITY_INFO))) {
positions.add(annotationModel.getPosition(annotation));
}
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/SortingTest.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/SortingTest.java
index 7595720a6..c45cd30b6 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/SortingTest.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/SortingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 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
@@ -13,16 +13,15 @@ package org.eclipse.search.tests.filesearch;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.eclipse.search.internal.ui.text.FileSearchQuery;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.FileTextSearchScope;
import org.eclipse.search.ui.text.Match;
-import org.eclipse.search.internal.ui.text.FileSearchQuery;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
public class SortingTest extends TestCase {
FileSearchQuery fQuery1;
@@ -58,7 +57,7 @@ public class SortingTest extends TestCase {
NewSearchUI.runQueryInForeground(null, fQuery1);
AbstractTextSearchResult result= (AbstractTextSearchResult) fQuery1.getSearchResult();
int originalMatchCount= result.getMatchCount();
- List allMatches= new ArrayList(originalMatchCount);
+ List<Match> allMatches= new ArrayList<>(originalMatchCount);
// first, collect all matches
Object[] elements= result.getElements();
@@ -73,7 +72,7 @@ public class SortingTest extends TestCase {
assertTrue("removed all matches", result.getMatchCount() == 0);
for (int i= allMatches.size()-1; i >= 0; i--) {
- result.addMatch((Match) allMatches.get(i));
+ result.addMatch(allMatches.get(i));
}
assertEquals("Test that all matches have been added again", result.getMatchCount(), originalMatchCount);

Back to the top