Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSopot Cela2016-02-03 09:27:52 -0500
committerSopot Cela2016-02-03 09:27:52 -0500
commitb0506297da6a094d95545ef5aa683ea71091420c (patch)
treefc69234564559d682844d0237c69ff5121596240 /org.eclipse.jface.text.tests
parent4e7aa5c62f126bb1ab1f6a4a527176bb2debd450 (diff)
downloadeclipse.platform.text-b0506297da6a094d95545ef5aa683ea71091420c.tar.gz
eclipse.platform.text-b0506297da6a094d95545ef5aa683ea71091420c.tar.xz
eclipse.platform.text-b0506297da6a094d95545ef5aa683ea71091420c.zip
Bug 487095 - Move test bundles to JUnit 4
Change-Id: I5f680056b22ec4fd2e27e4bfd305b03bc5ec4372 Signed-off-by: Sopot Cela <scela@redhat.com>
Diffstat (limited to 'org.eclipse.jface.text.tests')
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java25
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java42
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java14
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest2.java13
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java14
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java53
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java49
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java26
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java69
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java15
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java26
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java30
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java31
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java3
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java27
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java35
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/RulesTestSuite.java34
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java20
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java11
19 files changed, 273 insertions, 264 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java
index 0a6a828a6..1e26325de 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractPairMatcherTest.java
@@ -10,9 +10,17 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
+import org.junit.Test;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
@@ -29,16 +37,14 @@ import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
import org.eclipse.jface.text.source.ICharacterPairMatcher;
import org.eclipse.jface.text.source.ICharacterPairMatcherExtension;
-import junit.framework.TestCase;
-
/**
* Generic test of simple character pair matchers
*
* @since 3.3
*/
-public abstract class AbstractPairMatcherTest extends TestCase {
+public abstract class AbstractPairMatcherTest {
- private final boolean fCaretEitherSideOfBracket;
+ private boolean fCaretEitherSideOfBracket;
public AbstractPairMatcherTest(boolean caretEitherSideOfBracket) {
fCaretEitherSideOfBracket= caretEitherSideOfBracket;
@@ -66,6 +72,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
/* --- T e s t s --- */
/** Tests that the test case reader works */
+ @Test
public void testTestCaseReader() {
performReaderTest("%( )#", 0, 3, "( )");
performReaderTest("#%", 0, 0, "");
@@ -76,6 +83,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testSimpleMatchSameMatcher() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "#( )%");
@@ -108,6 +116,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testSimpleMatchDifferentMatchers() throws BadLocationException {
performMatch("()[]{}", "#( )%");
performMatch("()[]{}", "#[ ]%");
@@ -126,6 +135,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testCloseMatches() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "(%)#");
@@ -153,6 +163,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testIncompleteMatch() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "(% ");
@@ -166,6 +177,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testPartitioned() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "(% |a a| )#");
@@ -203,6 +215,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testTightPartitioned() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "(|b)%b|");
@@ -221,6 +234,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
}
/** Test that nesting works properly */
+ @Test
public void testNesting() {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, " ( #( ( ( ) ) ( ) )% ) ");
@@ -257,6 +271,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
*
* * @throws BadLocationException test failure
*/
+ @Test
public void testBoundaries() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
final StringDocument doc= new StringDocument("abcdefghijkl");
@@ -266,6 +281,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
matcher.dispose();
}
+ @Test
public void testBug156426() {
final ICharacterPairMatcher matcher= createMatcher("()[]{}<>");
performMatch(matcher, " #( a < b )% ");
@@ -275,6 +291,7 @@ public abstract class AbstractPairMatcherTest extends TestCase {
matcher.dispose();
}
+ @Test
public void testBug377417() {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "#( % )%#");
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
index 78c88a49d..decf2092f 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/AbstractUndoManagerTest.java
@@ -10,7 +10,13 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
@@ -23,10 +29,11 @@ import org.eclipse.jface.text.IUndoManager;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.TextViewer;
+
/**
* Tests for DefaultUndoManager.
*/
-public abstract class AbstractUndoManagerTest extends TestCase {
+public abstract class AbstractUndoManagerTest {
/** The maximum undo level. */
private static final int MAX_UNDO_LEVEL= 256;
@@ -51,15 +58,8 @@ public abstract class AbstractUndoManagerTest extends TestCase {
private static final boolean DEBUG= false;
- /*
- * @see TestCase#TestCase(String)
- */
- public AbstractUndoManagerTest(final String name) {
- super(name);
- }
-
- @Override
- protected void setUp() {
+ @Before
+ public void setUp() {
fShell= new Shell();
fUndoManager= createUndoManager(MAX_UNDO_LEVEL);
fTextViewer= new TextViewer(fShell, SWT.NONE);
@@ -69,8 +69,8 @@ public abstract class AbstractUndoManagerTest extends TestCase {
abstract protected IUndoManager createUndoManager(int maxUndoLevel);
- @Override
- protected void tearDown() {
+ @After
+ public void tearDown() {
fUndoManager.disconnect();
fUndoManager= null;
fShell.dispose();
@@ -81,6 +81,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
/**
* Test for line delimiter conversion.
*/
+ @Test
public void testConvertLineDelimiters() {
final String original= "a\r\nb\r\n";
final IDocument document= new Document(original);
@@ -106,6 +107,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
/**
* Randomly applies document changes.
*/
+ @Test
public void testRandomAccess() {
final int RANDOM_STRING_LENGTH= 50;
final int RANDOM_REPLACE_COUNT= 100;
@@ -183,6 +185,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
}
+ @Test
public void testLoopRandomAccessAsCompound() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -192,6 +195,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
}
+ @Test
public void testLoopRandomAccess() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -201,6 +205,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
}
+ @Test
public void testLoopRandomAccessAsUnclosedCompound() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -210,6 +215,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
}
+ @Test
public void testLoopConvertLineDelimiters() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -219,6 +225,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
}
+ @Test
public void testLoopRandomAccessWithMixedCompound() {
int i= 0;
while (i < LOOP_COUNT) {
@@ -228,6 +235,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
}
+ @Test
public void testRandomAccessAsCompound() {
final int RANDOM_STRING_LENGTH= 50;
final int RANDOM_REPLACE_COUNT= 100;
@@ -256,6 +264,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
/**
* Test case for https://bugs.eclipse.org/bugs/show_bug.cgi?id=88172
*/
+ @Test
public void testRandomAccessAsUnclosedCompound() {
final int RANDOM_STRING_LENGTH= 50;
@@ -283,6 +292,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertEquals(original, reverted);
}
+ @Test
public void testRandomAccessWithMixedCompound() {
final int RANDOM_STRING_LENGTH= 50;
@@ -318,6 +328,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertEquals(original, reverted);
}
+ @Test
public void testRepeatableAccess() {
assertTrue(REPLACEMENTS.length <= MAX_UNDO_LEVEL);
@@ -335,6 +346,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
+ @Test
public void testRepeatableAccessAsCompound() {
assertTrue(REPLACEMENTS.length <= MAX_UNDO_LEVEL);
@@ -355,6 +367,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
+ @Test
public void testRepeatableAccessAsUnclosedCompound() {
assertTrue(REPLACEMENTS.length <= MAX_UNDO_LEVEL);
@@ -373,6 +386,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
+ @Test
public void testRepeatableAccessWithMixedAndEmptyCompound() {
assertTrue(REPLACEMENTS.length + 2 <= MAX_UNDO_LEVEL);
@@ -401,6 +415,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
assertEquals(INITIAL_DOCUMENT_CONTENT, reverted);
}
+ @Test
public void testDocumentStamp() {
final Document document= new Document(INITIAL_DOCUMENT_CONTENT);
fTextViewer.setDocument(document);
@@ -412,6 +427,7 @@ public abstract class AbstractUndoManagerTest extends TestCase {
}
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=109104
+ @Test
public void testDocumentStamp2() throws BadLocationException {
final Document document= new Document("");
final int stringLength= 13;
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java
index cd53ca47e..e07fa1026 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest.java
@@ -10,11 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
+import org.junit.Test;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.source.ICharacterPairMatcher;
-import junit.framework.Test;
-import junit.framework.TestSuite;
/**
@@ -23,17 +23,13 @@ import junit.framework.TestSuite;
* @since 3.3
*/
public class DefaultPairMatcherTest extends AbstractPairMatcherTest {
-
+
public DefaultPairMatcherTest() {
super(false);
}
- public static Test suite() {
- return new TestSuite(DefaultPairMatcherTest.class);
- }
-
-
/** Tests that the test case reader works */
+ @Test
public void testTestCaseReader1() {
performReaderTest("#( )%", 3, 0, "( )");
performReaderTest("( )%", 3, -1, "( )");
@@ -44,6 +40,7 @@ public class DefaultPairMatcherTest extends AbstractPairMatcherTest {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testCloseMatches1() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "#()%");
@@ -57,6 +54,7 @@ public class DefaultPairMatcherTest extends AbstractPairMatcherTest {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testIncompleteMatch1() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "( %)");
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest2.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest2.java
index 30f6a16cc..a96583d22 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest2.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultPairMatcherTest2.java
@@ -10,13 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
+import org.junit.Test;
+
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.source.ICharacterPairMatcher;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
/**
* Tests for the default pair matcher.
*
@@ -24,16 +22,12 @@ import junit.framework.TestSuite;
*/
public class DefaultPairMatcherTest2 extends AbstractPairMatcherTest {
-
public DefaultPairMatcherTest2() {
super(true);
}
- public static Test suite() {
- return new TestSuite(DefaultPairMatcherTest2.class);
- }
-
/** Tests that the test case reader works */
+ @Test
public void testTestCaseReader1() {
performReaderTest("#( )%", 3, 0, "( )");
performReaderTest("( )%", 3, -1, "( )");
@@ -44,6 +38,7 @@ public class DefaultPairMatcherTest2 extends AbstractPairMatcherTest {
*
* @throws BadLocationException test failure
*/
+ @Test
public void testSimpleMatchSameMatcher1() throws BadLocationException {
final ICharacterPairMatcher matcher= createMatcher("()[]{}");
performMatch(matcher, "#( %)");
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java
index c087c0cb9..e061ca01f 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/DefaultUndoManagerTest.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.jface.text.DefaultUndoManager;
import org.eclipse.jface.text.IUndoManager;
@@ -23,17 +20,6 @@ import org.eclipse.jface.text.IUndoManager;
*/
public class DefaultUndoManagerTest extends AbstractUndoManagerTest {
- public static Test suite() {
- return new TestSuite(DefaultUndoManagerTest.class);
- }
-
- /*
- * @see TestCase#TestCase(String)
- */
- public DefaultUndoManagerTest(final String name) {
- super(name);
- }
-
@Override
protected IUndoManager createUndoManager(int maxUndoLevel) {
return new DefaultUndoManager(maxUndoLevel);
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
index ef1c09d6c..09e1c523b 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
@@ -19,6 +22,8 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.junit.Test;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
@@ -26,24 +31,12 @@ import org.eclipse.jface.internal.text.html.HTML2TextReader;
import org.eclipse.jface.text.TextPresentation;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-
-public class HTML2TextReaderTest extends TestCase {
+public class HTML2TextReaderTest {
private static final boolean DEBUG= false;
private static final String LD= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- public HTML2TextReaderTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(HTML2TextReaderTest.class);
- }
/**
* @param input input
@@ -117,61 +110,71 @@ public class HTML2TextReaderTest extends TestCase {
}
+ @Test
public void test0() throws IOException{
String string= "<code>3<5<code>";
String expected= "3<5";
verify(string, expected, 0);
}
-
+
+ @Test
public void test1() throws IOException{
String string= "<dl><dt>@author</dt><dd>Foo Bar</dd></dl>";
String expected= LD+ "@author"+LD+"\tFoo Bar"+LD;
verify(string, expected, 1);
}
-
+
+ @Test
public void test2() throws IOException{
String string= "<code>3>5<code>";
String expected= "3>5";
verify(string, expected, 0);
}
+ @Test
public void test3() throws IOException{
String string= "<a href= \"<p>this is only a string - not a tag<p>\">text</a>";
String expected= "text";
verify(string, expected, 0);
}
+ @Test
public void test4() throws IOException{
String string= "<html><body text=\"#000000\" bgcolor=\"#FFFF88\"><font size=-1><h5>void p.Bb.fes()</h5><p><dl><dt>Parameters:</dt><dd><b>i</b> fred or <code>null</code></dd></dl></font></body></html>";
String expected= "void p.Bb.fes()"+ LD + LD + LD+ "Parameters:"+ LD + "\ti fred or null"+LD;
verify(string, expected, 3);
}
-
+
+ @Test
public void test5() throws IOException{
String string= "<code>1<2<3<4</code>";
String expected= "1<2<3<4";
verify(string, expected, 0);
}
+ @Test
public void test6() throws IOException{
//test for bug 19070
String string= "<p>Something.<p>Something more.";
String expected= LD + "Something." + LD + "Something more.";
verify(string, expected, 0);
}
-
+
+ @Test
public void testEntity1() throws IOException {
String string= "&amp;";
String expected= "&";
verify(string, expected, 0);
}
+ @Test
public void testEntity2() throws IOException {
String string= "&unknown;";
String expected= "&unknown;";
verify(string, expected, 0);
}
-
+
+ @Test
public void testBug367378() throws IOException {
verify("<head>", "", 0);
verify("<head>some styles</html>", "", 0);
@@ -184,72 +187,84 @@ public class HTML2TextReaderTest extends TestCase {
assertTrue(Arrays.equals(new char[20], cb));
}
+ @Test
public void testComments() throws Exception {
String string= "<!-- begin-user-doc -->no comment<!-- end-user-doc -->";
String expected= "no comment";
verify(string, expected, 0);
}
-
+
+ @Test
public void testStyles1() throws IOException {
String string= "<b>Hello World</b>";
String expected= "Hello World";
verify(string, expected, 1);
}
+ @Test
public void testStyles2() throws IOException {
String string= "<del>Hello World</del>";
String expected= "Hello World";
verify(string, expected, 1);
}
+ @Test
public void testStyles3() throws IOException {
String string= "<b><del>Hello World</del></b>";
String expected= "Hello World";
verify(string, expected, 1);
}
+ @Test
public void testStyles4() throws IOException {
String string= "<del><b>Hello World</b></del>";
String expected= "Hello World";
verify(string, expected, 1);
}
+ @Test
public void testStyles5() throws IOException {
String string= "<b>This <del> is a </del> test</b>";
String expected= "This is a test";
verify(string, expected, 3);
}
+ @Test
public void testStyles6() throws IOException {
String string= "<del>This <b> is a </b> test</del>";
String expected= "This is a test";
verify(string, expected, 3);
}
+ @Test
public void testStyles7() throws IOException {
String string= "<b>This<del>is a</del>test</b>";
String expected= "Thisis atest";
verify(string, expected, 3);
}
+ @Test
public void testStyles8() throws IOException {
String string= "<del>This<b>is a</b>test</del>";
String expected= "Thisis atest";
verify(string, expected, 3);
}
+ @Test
public void testStyles9() throws IOException {
String string= "<b>This <del>is <b>yet</b> another</del> test</b>";
String expected= "This is yet another test";
verify(string, expected, 3);
}
+ @Test
public void testStyles10() throws IOException {
String string= "<del>This <b>is <del>yet</del> another </b>test</del>";
String expected= "This is yet another test";
verify(string, expected, 3);
}
+ @Test
public void testStylesWithPre() throws IOException {
String string= "I am <b>bold</b>." + LD + "<p>" + LD + "<pre>One" + LD + LD + "<b>T</b>hree.</pre>" + LD + "<p>" + LD + "<b>Author:</b> me.";
String expected= "I am bold. " + LD + "One" + LD + LD + "Three. " + LD + "Author: me.";
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
index 58be9f54d..a58187309 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
@@ -10,11 +10,16 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-import org.eclipse.jface.text.tests.reconciler.ReconcilerTestSuite;
-import org.eclipse.jface.text.tests.rules.RulesTestSuite;
+import org.eclipse.jface.text.tests.reconciler.AbstractReconcilerTest;
+import org.eclipse.jface.text.tests.rules.DefaultPartitionerTest;
+import org.eclipse.jface.text.tests.rules.DefaultPartitionerZeroLengthTest;
+import org.eclipse.jface.text.tests.rules.FastPartitionerTest;
+import org.eclipse.jface.text.tests.rules.ScannerColumnTest;
+import org.eclipse.jface.text.tests.rules.WordRuleTest;
/**
@@ -22,21 +27,23 @@ import org.eclipse.jface.text.tests.rules.RulesTestSuite;
*
* @since 3.0
*/
-public class JFaceTextTestSuite extends TestSuite {
-
- public static Test suite() {
- TestSuite suite= new TestSuite("Test Suite for org.eclipse.jface.text"); //$NON-NLS-1$
- suite.addTest(HTML2TextReaderTest.suite());
- suite.addTest(TextHoverPopupTest.suite());
- suite.addTest(TextPresentationTest.suite());
- suite.addTest(DefaultUndoManagerTest.suite());
- suite.addTest(TextViewerTest.suite());
- suite.addTest(TextViewerUndoManagerTest.suite());
- suite.addTest(RulesTestSuite.suite());
- suite.addTest(ReconcilerTestSuite.suite());
- suite.addTest(DefaultPairMatcherTest.suite());
- suite.addTest(DefaultPairMatcherTest2.suite());
-
- return suite;
- }
+@RunWith(Suite.class)
+@SuiteClasses({
+ HTML2TextReaderTest.class,
+ TextHoverPopupTest.class,
+ TextPresentationTest.class,
+ DefaultUndoManagerTest.class,
+ TextViewerTest.class,
+ TextViewerUndoManagerTest.class,
+ DefaultPairMatcherTest.class,
+ DefaultPairMatcherTest2.class,
+ AbstractReconcilerTest.class,
+ DefaultPartitionerTest.class,
+ DefaultPartitionerZeroLengthTest.class,
+ FastPartitionerTest.class,
+ ScannerColumnTest.class,
+ WordRuleTest.class
+})
+public class JFaceTextTestSuite {
+// intentionally left empty
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
index bd791bd0d..1c29c1ae6 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextHoverPopupTest.java
@@ -10,30 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
-public class TextHoverPopupTest extends TestCase {
-
-
- public TextHoverPopupTest(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() {
- }
-
- public static Test suite() {
- return new TestSuite(TextHoverPopupTest.class);
- }
-
- @Override
- protected void tearDown() {
- }
-
+public class TextHoverPopupTest {
protected int search(int[] array, int x) {
int low= 0;
@@ -53,6 +34,7 @@ public class TextHoverPopupTest extends TestCase {
return high;
}
+ @Test
public void testSearch() {
int[] values= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (int i= 0; i < 10; i++) {
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java
index 3572129f1..03f980afe 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextPresentationTest.java
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.Iterator;
+import org.junit.Before;
+import org.junit.Test;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Color;
@@ -20,11 +26,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextPresentation;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class TextPresentationTest extends TestCase {
+public class TextPresentationTest {
private static final int NORMAL= SWT.NORMAL;
private static final int BOLD= SWT.BOLD;
@@ -34,12 +36,8 @@ public class TextPresentationTest extends TestCase {
private StyleRange[] fAllRanges;
private StyleRange[] fNonDefaultRanges;
- public static Test suite() {
- return new TestSuite(TextPresentationTest.class);
- }
-
- @Override
- protected void setUp() {
+ @Before
+ public void setUp() {
setUpStyleRanges();
setUpTextPresentation();
}
@@ -113,15 +111,18 @@ public class TextPresentationTest extends TestCase {
assertTrue(!e.hasNext());
}
+ @Test
public void testUnclippedRegions() {
checkRegions(fAllRanges, fNonDefaultRanges);
}
-
+
+ @Test
public void testClippedRegions1() {
fTextPresentation.setResultWindow(new Region(0, 140));
checkRegions(fAllRanges, fNonDefaultRanges);
}
+ @Test
public void testClippedRegions2() {
fTextPresentation.setResultWindow(new Region(30, 70));
@@ -144,6 +145,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range at start of first existing range.
*/
+ @Test
public void testMergeStyleRange1() {
StyleRange range= createStyleRange(0, 2, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -172,6 +174,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range at end of last existing range.
*/
+ @Test
public void testMergeStyleRange2() {
StyleRange range= createStyleRange(138, 140, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -200,6 +203,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range at start of existing default range.
*/
+ @Test
public void testMergeStyleRange3() {
StyleRange range= createStyleRange(20, 22, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -228,6 +232,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range within existing default range.
*/
+ @Test
public void testMergeStyleRange4() {
StyleRange range= createStyleRange(22, 24, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -257,6 +262,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range at end of existing default range.
*/
+ @Test
public void testMergeStyleRange5() {
StyleRange range= createStyleRange(45, 47, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -285,6 +291,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range at start of existing non-default range.
*/
+ @Test
public void testMergeStyleRange6() {
StyleRange range= createStyleRange(47, 49, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -313,6 +320,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range within existing non-default range.
*/
+ @Test
public void testMergeStyleRange7() {
StyleRange range= createStyleRange(49, 51, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -343,6 +351,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range at end of existing non-default range.
*/
+ @Test
public void testMergeStyleRange8() {
StyleRange range= createStyleRange(52, 54, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -371,6 +380,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range from existing default to non-default range.
*/
+ @Test
public void testMergeStyleRange9() {
StyleRange range= createStyleRange(45, 49, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -401,6 +411,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range from existing non-default to default range.
*/
+ @Test
public void testMergeStyleRange10() {
StyleRange range= createStyleRange(52, 56, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -431,6 +442,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range from existing default over non-default to default range.
*/
+ @Test
public void testMergeStyleRange11() {
StyleRange range= createStyleRange(45, 56, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -461,6 +473,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range from existing non-default over default to non-default range.
*/
+ @Test
public void testMergeStyleRange12() {
StyleRange range= createStyleRange(52, 98, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -492,6 +505,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range over existing default range.
*/
+ @Test
public void testMergeStyleRange13() {
StyleRange range= createStyleRange(20, 47, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -519,6 +533,7 @@ public class TextPresentationTest extends TestCase {
/**
* Merge range over existing non-default range.
*/
+ @Test
public void testMergeStyleRange14() {
StyleRange range= createStyleRange(47, 54, 1, -1, NORMAL);
fTextPresentation.mergeStyleRange(range);
@@ -542,6 +557,7 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
+ @Test
public void testMergeStyleRanges1() {
StyleRange[] ranges= new StyleRange[] {
createStyleRange(0, 2, 1, -1, NORMAL), // at start of first existing
@@ -593,33 +609,4 @@ public class TextPresentationTest extends TestCase {
checkRegions(expectedAllRanges, expectedNonDefaultRanges);
}
-// Template
-//
-// public void testMergeStyleRange0() {
-//// StyleRange range= createStyleRange(0, 2, 1, -1, NORMAL);
-//// fTextPresentation.mergeStyleRange(range);
-//
-//// StyleRange[] ranges= new StyleRange[] {
-//// createStyleRange(0, 2, 1, -1, NORMAL),
-//// };
-//// fTextPresentation.mergeStyleRanges(ranges);
-//
-// StyleRange[] expectedAllRanges= new StyleRange[] {
-// createStyleRange( 0, 4, NORMAL),
-// createStyleRange( 4, 20, BOLD),
-// createStyleRange( 20, 47, NORMAL),
-// createStyleRange( 47, 54, BOLD),
-// createStyleRange( 54, 96, NORMAL),
-// createStyleRange( 96, 102, BOLD),
-// createStyleRange(102, 140, NORMAL),
-// };
-//
-// StyleRange[] expectedNonDefaultRanges= new StyleRange[] {
-// createStyleRange( 4, 20, BOLD),
-// createStyleRange( 47, 54, BOLD),
-// createStyleRange( 96, 102, BOLD),
-// };
-//
-// checkRegions(expectedAllRanges, expectedNonDefaultRanges);
-// }
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java
index d456823a4..0cdaac4d7 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerTest.java
@@ -10,9 +10,10 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
@@ -23,11 +24,9 @@ import org.eclipse.jface.text.TextViewer;
/**
* Basic tests for TextViewer.
*/
-public class TextViewerTest extends TestCase {
- public static Test suite() {
- return new TestSuite(TextViewerTest.class);
- }
-
+public class TextViewerTest {
+
+ @Test
public void testSetRedraw_Bug441827() throws Exception {
Shell shell= new Shell();
try {
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
index 48ad3498f..6a55089c9 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.jface.text.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.AbstractOperation;
@@ -39,17 +41,6 @@ import org.eclipse.jface.text.TextViewerUndoManager;
*/
public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
- public static Test suite() {
- return new TestSuite(TextViewerUndoManagerTest.class);
- }
-
- /*
- * @see TestCase#TestCase(String)
- */
- public TextViewerUndoManagerTest(final String name) {
- super(name);
- }
-
@Override
protected IUndoManager createUndoManager(int maxUndoLevel) {
return new TextViewerUndoManager(maxUndoLevel);
@@ -105,15 +96,18 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
undoManager.disconnect(newContext);
}
-
+
+ @Test
public void testTransferNonUndoableNonTextOp() throws Exception {
internalTestTransferNonTextOp(false);
}
-
+
+ @Test
public void testTransferUndoableNonTextOp() throws Exception {
internalTestTransferNonTextOp(true);
}
-
+
+ @Test
public void testCanUndo() throws Exception {
IDocument doc= new Document();
final DocumentUndoManager undoManager= new DocumentUndoManager(doc);
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java
index 1a7471580..b967611a7 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/AbstractReconcilerTest.java
@@ -10,11 +10,18 @@
*******************************************************************************/
package org.eclipse.jface.text.tests.reconciler;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -40,7 +47,7 @@ import org.eclipse.jface.text.tests.TestTextViewer;
*
* @since 3.1
*/
-public class AbstractReconcilerTest extends TestCase {
+public class AbstractReconcilerTest {
/**
* Modified barrier: there are two threads: the main (testing) thread
@@ -135,8 +142,8 @@ public class AbstractReconcilerTest extends TestCase {
private IProgressMonitor fProgressMonitor;
- @Override
- protected void setUp() {
+ @Before
+ public void setUp() {
fBarrier= new Barrier();
fCallLog= Collections.synchronizedList(new ArrayList<String>());
fReconciler= new AbstractReconciler() {
@@ -181,13 +188,13 @@ public class AbstractReconcilerTest extends TestCase {
fAccessor= new Accessor(object, object.getClass());
}
-
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
fBarrier.shutdown();
fReconciler.uninstall();
}
+ @Test
public void testInitialReconcile() throws InterruptedException {
// initially the reconciler is neither active nor dirty
// XXX shouldn't it be dirty?
@@ -212,7 +219,8 @@ public class AbstractReconcilerTest extends TestCase {
assertFalse(isActive());
assertFalse(isDirty());
}
-
+
+ @Test
public void testDirtyingWhenClean() throws BadLocationException, InterruptedException {
installDocument();
@@ -237,7 +245,7 @@ public class AbstractReconcilerTest extends TestCase {
fDocument.replace(0,0,"bar");
}
-
+ @Test
public void testDirtyingWhenRunning() throws InterruptedException, BadLocationException {
installDocument();
@@ -266,6 +274,7 @@ public class AbstractReconcilerTest extends TestCase {
assertFalse(isDirty());
}
+ @Test
public void testCancellingWhenClean() throws InterruptedException, BadLocationException {
installDocument();
@@ -284,6 +293,7 @@ public class AbstractReconcilerTest extends TestCase {
// assertFalse(isDirty()); // fails
}
+ @Test
public void testCancellingWhenRunning() throws InterruptedException, BadLocationException {
installDocument();
@@ -300,6 +310,7 @@ public class AbstractReconcilerTest extends TestCase {
// assertFalse(isDirty());
}
+ @Test
public void testReplacingDocumentWhenClean() throws InterruptedException {
installDocument();
@@ -318,6 +329,7 @@ public class AbstractReconcilerTest extends TestCase {
assertFalse(isDirty());
}
+ @Test
public void testReplacingDocumentWhenRunning() throws InterruptedException, BadLocationException {
installDocument();
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java
deleted file mode 100644
index 9885fb3aa..000000000
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/reconciler/ReconcilerTestSuite.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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.jface.text.tests.reconciler;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- *
- * @since 3.0
- */
-public class ReconcilerTestSuite {
-
- public static Test suite() {
- TestSuite suite= new TestSuite("Test Suite org.eclipse.jface.text.tests.reconciler");
- //$JUnit-BEGIN$
- suite.addTestSuite(AbstractReconcilerTest.class);
- //$JUnit-END$
- return suite;
- }
-}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java
index bfa5ad90c..70059226b 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerTest.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.jface.text.tests.rules;
+import org.junit.Test;
+
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.DefaultPartitioner;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
@@ -21,6 +23,7 @@ public class DefaultPartitionerTest extends FastPartitionerTest {
}
@Override
+ @Test
public void testPR130900() throws Exception {
System.out.println("Bug130900 not fixed in DefaultPartitioner");
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java
index 965a3ebb6..84ceece6a 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/DefaultPartitionerZeroLengthTest.java
@@ -11,7 +11,10 @@
package org.eclipse.jface.text.tests.rules;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
@@ -28,7 +31,7 @@ import org.eclipse.jface.text.rules.Token;
/**
* @since 3.0
*/
-public class DefaultPartitionerZeroLengthTest extends TestCase {
+public class DefaultPartitionerZeroLengthTest {
private static final String COMMENT= "comment";
private static final String DEFAULT= IDocument.DEFAULT_CONTENT_TYPE;
@@ -36,7 +39,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
private IDocument fDoc;
private FastPartitioner fPartitioner;
- @Override
+ @Before
public void setUp() {
fDoc= new Document();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
@@ -52,6 +55,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
fPartitioner.connect(fDoc);
}
+ @Test
public void testGetZeroLengthPartition() {
fDoc.set("docu ment/* comment */docu ment");
@@ -59,6 +63,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthPartition_InterleavingPartitions(offsets);
}
+ @Test
public void testGetZeroLengthPartitionEmptyMiddle() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -66,6 +71,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthPartition_InterleavingPartitions(offsets);
}
+ @Test
public void testGetZeroLengthPartitionEmptyStart() {
fDoc.set("/* comment */docu ment");
@@ -73,6 +79,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthPartition_InterleavingPartitions(offsets);
}
+ @Test
public void testGetZeroLengthPartitionEmptyEnd() {
fDoc.set("docu ment/* comment */");
@@ -80,6 +87,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthPartition_InterleavingPartitions(offsets);
}
+ @Test
public void testGetZeroLengthContentType() {
fDoc.set("docu ment/* comment */docu ment");
@@ -87,6 +95,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testGetZeroLengthContentTypeEmptyMiddle() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -94,6 +103,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testGetZeroLengthContentTypeEmptyStart() {
fDoc.set("/* comment */docu ment");
@@ -101,6 +111,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testGetZeroLengthContentTypeEmptyEnd() {
fDoc.set("docu ment/* comment */");
@@ -108,6 +119,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertGetZeroLengthContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testComputeZeroLengthPartitioning() {
fDoc.set("docu ment/* comment */docu ment");
@@ -115,6 +127,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputeZeroLengthPartitioningEmptyMiddle() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -122,6 +135,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputeZeroLengthPartitioningEmptyStart() {
fDoc.set("/* comment */docu ment");
@@ -129,6 +143,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputeZeroLengthPartitioningEmptyEnd() {
fDoc.set("docu ment/* comment */");
@@ -136,6 +151,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputePartitioningSubrangeBeforeBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -143,6 +159,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(12, 38, offsets, DEFAULT);
}
+ @Test
public void testComputePartitioningSubrangeOnBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -150,6 +167,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(13, 39, offsets, DEFAULT);
}
+ @Test
public void testComputePartitioningSubrangeOnBoundaries2() {
fDoc.set("/* comment *//* comment *//* comment */");
@@ -157,6 +175,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(13, 26, offsets, DEFAULT);
}
+ @Test
public void testComputePartitioningSubrangeAfterBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -164,6 +183,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(14, 40, offsets, COMMENT);
}
+ @Test
public void testComputePartitioningSubrangeInBoundaries1() {
fDoc.set("/* comment */");
@@ -171,6 +191,7 @@ public class DefaultPartitionerZeroLengthTest extends TestCase {
assertComputeZeroLengthPartitioning_InterleavingPartitions(1, 12, offsets, COMMENT);
}
+ @Test
public void testComputePartitioningSubrangeInBoundaries2() {
fDoc.set("docu ment");
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
index df25fb9fd..97c6a4e4d 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/FastPartitionerTest.java
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.jface.text.tests.rules;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
@@ -30,7 +33,7 @@ import org.eclipse.jface.text.rules.Token;
/**
* @since 3.0
*/
-public class FastPartitionerTest extends TestCase {
+public class FastPartitionerTest {
protected static final String COMMENT= "comment";
protected static final String DEFAULT= IDocument.DEFAULT_CONTENT_TYPE;
@@ -38,7 +41,7 @@ public class FastPartitionerTest extends TestCase {
private IDocument fDoc;
private IDocumentPartitioner fPartitioner;
- @Override
+ @Before
public void setUp() {
fDoc= new Document();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
@@ -58,6 +61,7 @@ public class FastPartitionerTest extends TestCase {
return new FastPartitioner(scanner, new String[] { DEFAULT, COMMENT });
}
+ @Test
public void testGetPartition() {
fDoc.set("docu ment/* comment */docu ment");
@@ -65,13 +69,15 @@ public class FastPartitionerTest extends TestCase {
assertGetPartition_InterleavingPartitions(offsets);
}
+ @Test
public void testGetPartitionEmptyMiddle() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
int[] offsets= new int[] { 13, 26, 26, 39 };
assertGetPartition_InterleavingPartitions(offsets);
}
-
+
+ @Test
public void testGetPartitionEmptyStart() {
fDoc.set("/* comment */docu ment");
@@ -79,6 +85,7 @@ public class FastPartitionerTest extends TestCase {
assertGetPartition_InterleavingPartitions(offsets);
}
+ @Test
public void testGetPartitionEmptyEnd() {
fDoc.set("docu ment/* comment */");
@@ -86,6 +93,7 @@ public class FastPartitionerTest extends TestCase {
assertGetPartition_InterleavingPartitions(offsets);
}
+ @Test
public void testGetContentType() {
fDoc.set("docu ment/* comment */docu ment");
@@ -93,6 +101,7 @@ public class FastPartitionerTest extends TestCase {
assertGetContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testGetContentTypeEmptyMiddle() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -100,6 +109,7 @@ public class FastPartitionerTest extends TestCase {
assertGetContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testGetContentTypeEmptyStart() {
fDoc.set("/* comment */docu ment");
@@ -107,6 +117,7 @@ public class FastPartitionerTest extends TestCase {
assertGetContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testGetContentTypeEmptyEnd() {
fDoc.set("docu ment/* comment */");
@@ -114,6 +125,7 @@ public class FastPartitionerTest extends TestCase {
assertGetContentType_InterleavingPartitions(offsets);
}
+ @Test
public void testComputePartitioning() {
fDoc.set("docu ment/* comment */docu ment");
@@ -121,6 +133,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputePartitioningEmptyMiddle() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -128,6 +141,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputePartitioningEmptyStart() {
fDoc.set("/* comment */docu ment");
@@ -135,6 +149,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputePartitioningEmptyEnd() {
fDoc.set("docu ment/* comment */");
@@ -142,6 +157,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testComputePartitioningSubrangeBeforeBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -149,6 +165,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(12, 38, offsets, DEFAULT);
}
+ @Test
public void testComputePartitioningSubrangeOnBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -156,6 +173,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(13, 39, offsets, DEFAULT);
}
+ @Test
public void testComputePartitioningSubrangeOnBoundaries2() {
fDoc.set("/* comment *//* comment *//* comment */");
@@ -163,6 +181,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(13, 26, offsets, DEFAULT);
}
+ @Test
public void testComputePartitioningSubrangeAfterBoundaries() {
fDoc.set("docu ment/* comment *//* comment */docu ment");
@@ -170,6 +189,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(14, 40, offsets, COMMENT);
}
+ @Test
public void testComputePartitioningSubrangeInBoundaries1() {
fDoc.set("/* comment */");
@@ -177,6 +197,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(1, 12, offsets, COMMENT);
}
+ @Test
public void testComputePartitioningSubrangeInBoundaries2() {
fDoc.set("docu ment");
@@ -184,6 +205,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(1, 12, offsets, DEFAULT);
}
+ @Test
public void testPR101014() throws BadLocationException {
fDoc.set(
"package pr101014;\n" +
@@ -200,6 +222,7 @@ public class FastPartitionerTest extends TestCase {
assertComputePartitioning_InterleavingPartitions(offsets);
}
+ @Test
public void testPR130900() throws Exception {
fPartitioner.disconnect();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
@@ -219,6 +242,7 @@ public class FastPartitionerTest extends TestCase {
}
+ @Test
public void testBug368219_1() throws Exception {
fPartitioner.disconnect();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
@@ -237,6 +261,7 @@ public class FastPartitionerTest extends TestCase {
}
+ @Test
public void testBug368219_2() throws Exception {
fPartitioner.disconnect();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
@@ -255,6 +280,7 @@ public class FastPartitionerTest extends TestCase {
}
+ @Test
public void testBug409538_1() throws Exception {
fPartitioner.disconnect();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
@@ -273,6 +299,7 @@ public class FastPartitionerTest extends TestCase {
}
+ @Test
public void testBug409538_2() throws Exception {
fPartitioner.disconnect();
IPartitionTokenScanner scanner= new RuleBasedPartitionScanner() {
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/RulesTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/RulesTestSuite.java
deleted file mode 100644
index 48deb6de6..000000000
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/RulesTestSuite.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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.jface.text.tests.rules;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * @since 3.0
- */
-public class RulesTestSuite {
-
- public static Test suite() {
- TestSuite suite= new TestSuite(
- "Test Suite org.eclipse.jface.text.tests.rules");
- // $JUnit-BEGIN$
- suite.addTestSuite(FastPartitionerTest.class);
- suite.addTestSuite(DefaultPartitionerTest.class);
- suite.addTestSuite(DefaultPartitionerZeroLengthTest.class);
- suite.addTestSuite(WordRuleTest.class);
- suite.addTestSuite(ScannerColumnTest.class);
- // $JUnit-END$
- return suite;
- }
-}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java
index e2a31ce7e..0504320bb 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/ScannerColumnTest.java
@@ -10,7 +10,11 @@
*******************************************************************************/
package org.eclipse.jface.text.tests.rules;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
@@ -21,32 +25,36 @@ import org.eclipse.jface.text.rules.RuleBasedScanner;
/**
* @since 3.4
*/
-public class ScannerColumnTest extends TestCase {
+public class ScannerColumnTest {
private IDocument fDocument;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() {
fDocument= new Document("scanner test");
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() {
fDocument= null;
}
+ @Test
public void testRuleBasedScannerColumnRead() {
_testScannerColumnRead(new RuleBasedScanner());
}
+ @Test
public void testRuleBasedScannerColumnUnread() {
_testScannerColumnUnread(new RuleBasedScanner());
}
+ @Test
public void testBufferedRuleBasedScannerColumnRead() {
_testScannerColumnRead(new BufferedRuleBasedScanner(100));
}
+ @Test
public void testBufferedRuleBasedScannerColumnUnread() {
_testScannerColumnUnread(new BufferedRuleBasedScanner(100));
}
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java
index 2a0354229..23d966120 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/rules/WordRuleTest.java
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.jface.text.tests.rules;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
import org.eclipse.swt.SWT;
@@ -28,7 +31,7 @@ import org.eclipse.jface.text.rules.WordRule;
/**
* @since 3.3
*/
-public class WordRuleTest extends TestCase {
+public class WordRuleTest {
private static class SimpleWordDetector implements IWordDetector {
@@ -47,6 +50,7 @@ public class WordRuleTest extends TestCase {
/*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=163116
*/
+ @Test
public void testBug163116() throws Exception {
IWordDetector detector= new IWordDetector() {
@@ -80,6 +84,7 @@ public class WordRuleTest extends TestCase {
/*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=144355
*/
+ @Test
public void testBug144355() throws Exception {
IWordDetector detector= new SimpleWordDetector();
@@ -139,6 +144,7 @@ public class WordRuleTest extends TestCase {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=175712
+ @Test
public void testBug175712_1() throws Exception {
IRule[] rules= new IRule[2];
@@ -175,6 +181,7 @@ public class WordRuleTest extends TestCase {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=175712
+ @Test
public void testBug175712_2() throws Exception {
IRule[] rules= new IRule[2];

Back to the top