Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/org.eclipse.text.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Export-Package:
Require-Bundle:
org.eclipse.core.commands;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.text;bundle-version="[3.6.3,4.0.0)",
org.junit;bundle-version="4.12.0"
org.eclipse.text;bundle-version="[3.6.3,4.0.0)"
Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)",
org.junit.jupiter.api.function;version="[5.14.0,6.0.0)",
org.junit.platform.suite.api;version="[1.14.0,2.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Eclipse-BundleShape: dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
*******************************************************************************/
package org.eclipse.text.tests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DefaultLineTracker;
Expand Down Expand Up @@ -117,15 +117,15 @@ private String getOriginalMasterContents() {
"99999999999999999999";
}

@Before
@BeforeEach
public void setUp() {
fMasterDocument= new Document();
fMasterDocument.set(getOriginalMasterContents());
fSlaveDocumentManager= new ProjectionDocumentManager();
fSlaveDocument= (ProjectionDocument) fSlaveDocumentManager.createSlaveDocument(fMasterDocument);
}

@After
@AfterEach
public void tearDown () {
fSlaveDocumentManager.freeSlaveDocument(fSlaveDocument);
fSlaveDocument= null;
Expand Down Expand Up @@ -251,12 +251,12 @@ private void assertFragmentation(Position[] expected, boolean checkWellFormednes
}

Position[] segmentation= fSlaveDocument.getSegments2();
assertTrue("invalid number of segments", expected.length == segmentation.length);
assertTrue(expected.length == segmentation.length, "invalid number of segments");

for (int i= 0; i < expected.length; i++) {
Segment segment= (Segment) segmentation[i];
Fragment actual= segment.fragment;
Assert.assertEquals(print(actual) + " != " + print(expected[i]), expected[i], actual);
Assertions.assertEquals(expected[i], actual, print(actual) + " != " + print(expected[i]));
}

}
Expand All @@ -267,15 +267,15 @@ private void assertLineInformationConsistency(IDocument document) {

int textLines= textTracker.getNumberOfLines();
int trackerLines= document.getNumberOfLines();
Assert.assertEquals(trackerLines, textLines);
Assertions.assertEquals(trackerLines, textLines);

for (int i= 0; i < trackerLines; i++) {
try {
IRegion trackerLine= document.getLineInformation(i);
IRegion textLine= textTracker.getLineInformation(i);

Assert.assertEquals(trackerLine.getOffset(), textLine.getOffset());
Assert.assertEquals(trackerLine.getLength(), textLine.getLength());
Assertions.assertEquals(trackerLine.getOffset(), textLine.getOffset());
Assertions.assertEquals(trackerLine.getLength(), textLine.getLength());

} catch (BadLocationException e) {
assertTrue(false);
Expand All @@ -286,7 +286,7 @@ private void assertLineInformationConsistency(IDocument document) {
private void assertContents(String expected, IDocument document) {
assertWellFormedSegmentation();
assertWellFormedFragmentation();
Assert.assertEquals(expected, document.get());
Assertions.assertEquals(expected, document.get());
assertLineInformationConsistency(document);
}

Expand Down Expand Up @@ -682,9 +682,9 @@ public void test9_7() {

try {
int startOffset= fMasterDocument.getLineOffset(4);
Assert.assertEquals(80, startOffset);
Assertions.assertEquals(80, startOffset);
int endOffset= fMasterDocument.getLineOffset(7);
Assert.assertEquals(140, endOffset);
Assertions.assertEquals(140, endOffset);
fSlaveDocument.addMasterDocumentRange(startOffset, endOffset - startOffset);

assertSlaveContents(getOriginalMasterContents().substring(80, 140));
Expand Down Expand Up @@ -1629,12 +1629,12 @@ public void test21_a() {

private void assertEquals(DocumentEvent expected, DocumentEvent received) {
assertSame(expected.getDocument(), received.getDocument());
Assert.assertEquals(expected.getOffset(), received.getOffset());
Assert.assertEquals(expected.getLength(), received.getLength());
Assertions.assertEquals(expected.getOffset(), received.getOffset());
Assertions.assertEquals(expected.getLength(), received.getLength());
if (expected.getText() == null || expected.getText().isEmpty())
assertTrue(received.getText() == null || received.getText().isEmpty());
else
Assert.assertEquals(expected.getText(), received.getText());
Assertions.assertEquals(expected.getText(), received.getText());
}

private void assertSlaveEvents(DocumentEvent[] expected, DocumentEvent[] received) {
Expand Down Expand Up @@ -2120,9 +2120,9 @@ private void assertRegions(IRegion[] expected, IRegion[] actual) {
assertNull(expected);
}

assertTrue("invalid number of regions", expected.length == actual.length);
assertTrue(expected.length == actual.length, "invalid number of regions");
for (int i= 0; i < expected.length; i++)
Assert.assertEquals(print(actual[i]) + " != " + print(expected[i]), expected[i], actual[i]);
Assertions.assertEquals(expected[i], actual[i], print(actual[i]) + " != " + print(expected[i]));
}

private void assertUnprojectedMasterRegions(IRegion[] expected, int offsetInMaster, int lengthInMaster) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
*******************************************************************************/
package org.eclipse.text.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
Expand Down Expand Up @@ -107,7 +109,7 @@ private void createLineWrappingProjection() {
addProjection(70, 30, 10);
}

@Before
@BeforeEach
public void setUp() {
fMasterDocument= new Document();
fSlaveDocument= new Document();
Expand All @@ -119,7 +121,7 @@ public void setUp() {
}


@After
@AfterEach
public void tearDown() {
fMasterDocument= null;
fSlaveDocument= null;
Expand Down Expand Up @@ -627,7 +629,7 @@ public void test10c() {
}

private void assertRegions(IRegion[] expected, IRegion[] actual) {
assertTrue("invalid number of regions", expected.length == actual.length);
assertTrue(expected.length == actual.length, "invalid number of regions");
for (int i= 0; i < expected.length; i++)
assertEquals(expected[i], actual[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package org.eclipse.text.tests;

import org.junit.platform.suite.api.Suite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*******************************************************************************/
package org.eclipse.text.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.eclipse.jface.text.GapTextStore;

Expand Down Expand Up @@ -72,7 +73,7 @@ private String printGap(int start, int end) {
}

protected void assertGap(int start, int end) {
assertTrue("Invalid gap. Expected: " + printGap(start, end) + " actual:" + printGap() , fText.getGapStart() == start && fText.getGapEnd() == end);
assertTrue(fText.getGapStart() == start && fText.getGapEnd() == end, "Invalid gap. Expected: " + printGap(start, end) + " actual:" + printGap());
}

protected void assertContents(String expected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
*******************************************************************************/
package org.eclipse.text.tests;

import static org.junit.Assert.assertEquals;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.ILineTracker;
Expand All @@ -29,14 +30,14 @@ public abstract class AbstractLineTrackerTest {
protected ILineTracker fTracker;

protected final void checkLines(int[] lines) throws BadLocationException {
assertEquals("number of lines", lines.length, fTracker.getNumberOfLines());
assertEquals(lines.length, fTracker.getNumberOfLines(), "number of lines");

for (int i= 0; i < lines.length; i++) {
IRegion line= fTracker.getLineInformation(i);

assertEquals("line lenght of line " + i, lines[i], line.getLength());
assertEquals(lines[i], line.getLength(), "line lenght of line " + i);

assertEquals("line offset of line " + i, getLineOffset(i, lines), line.getOffset());
assertEquals(getLineOffset(i, lines), line.getOffset(), "line offset of line " + i);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
*******************************************************************************/
package org.eclipse.text.tests;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class AdaptiveGapTextTest extends AbstractGapTextTest {

@Before
@BeforeEach
public void setUp() {
fText= new GapText(2, 10, 0.5f);
fText.set("xxxxx");
}

@After
@AfterEach
public void tearDown () {
fText= null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
*******************************************************************************/
package org.eclipse.text.tests;

import static org.junit.Assert.fail;

import static org.junit.jupiter.api.Assertions.fail;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
Expand Down Expand Up @@ -102,7 +103,7 @@ public void removeAllAnnotations() {
private Annotation fAfterIn;
private Annotation fAfterOut;

@Before
@BeforeEach
public void setUp() {
fDocument= new Document("How much wood\nwould a woodchuck chuck\nif a woodchuck\ncould chuck wood?\n42");

Expand All @@ -129,7 +130,7 @@ public void setUp() {
fAnnotationModel.connect(fDocument);
}

@After
@AfterEach
public void tearDown() {
fAnnotationModel.disconnect(fDocument);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
*******************************************************************************/
package org.eclipse.text.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.Position;
Expand Down Expand Up @@ -1216,7 +1217,7 @@ public AnnotationData(int offset, int length, int annotationNumber) {
private AnnotationModel fInnerModel1;
private AnnotationModel fInnerModel2;

@Before
@BeforeEach
public void setUp() throws Exception {
fDocument= new Document(RANDOM_CONTENT);

Expand All @@ -1231,7 +1232,7 @@ public void setUp() throws Exception {
fAnnotationModel.connect(fDocument);
}

@After
@AfterEach
public void tearDown() throws Exception {
fAnnotationModel.disconnect(fDocument);

Expand Down
Loading
Loading