Bug 558441: Update tests in jcommons to use JUnit 5 jupiter
Change-Id: I1ed127da04683e6adc008c4b6cfc5795bc6b965c
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/META-INF/MANIFEST.MF b/jcommons/org.eclipse.statet.jcommons.text.core-tests/META-INF/MANIFEST.MF
index e0c1fda..992dac3 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/META-INF/MANIFEST.MF
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/META-INF/MANIFEST.MF
@@ -6,4 +6,5 @@
Bundle-Vendor: Eclipse StatET
Bundle-Name: StatET JCommons - Text - Core - Tests (Incubation)
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.junit;bundle-version="4.12.0"
+Import-Package: org.junit.jupiter.api;version="5.5.1",
+ org.junit.jupiter.api.function;version="5.5.1"
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/SearchPatternTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/SearchPatternTest.java
index 133f76b..27dcf9b 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/SearchPatternTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/SearchPatternTest.java
@@ -14,14 +14,14 @@
package org.eclipse.statet.jcommons.text.core;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.eclipse.statet.jcommons.text.core.SearchPattern.PREFIX_MATCH;
import static org.eclipse.statet.jcommons.text.core.SearchPattern.SUBSTRING_MATCH;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/AbstractTextParserInputTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/AbstractTextParserInputTest.java
new file mode 100644
index 0000000..e915c21
--- /dev/null
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/AbstractTextParserInputTest.java
@@ -0,0 +1,70 @@
+/*=============================================================================#
+ # Copyright (c) 2019 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.jcommons.text.core.input;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+
+
+@NonNullByDefault
+public class AbstractTextParserInputTest<T extends TextParserInput> {
+
+
+ protected T input;
+
+
+ public AbstractTextParserInputTest() {
+ }
+
+
+ protected void readConsume(final String expected, int begin, final int end, final int consume) {
+ while (begin < end) {
+ final int l= Math.min(end - begin, consume);
+ assertEquals(begin, this.input.getIndex());
+ assertEquals(0, this.input.getLengthInSource(0));
+ assertChars(expected, begin, begin + l);
+ assertEquals(l, this.input.getLengthInSource(l));
+ this.input.consume(l);
+ begin+= l;
+ }
+ }
+
+ protected void readConsume(final String expected, final int[] indexes, int begin, final int end, final int consume) {
+ while (begin < end) {
+ final int l= Math.min(end - begin, consume);
+ assertEquals(indexes[begin], this.input.getIndex());
+ assertEquals(0, this.input.getLengthInSource(0));
+ assertChars(expected, begin, begin + l);
+ assertEquals(indexes[begin + l - 1] + 1 - indexes[begin], this.input.getLengthInSource(l));
+ this.input.consume(l);
+ begin+= l;
+ }
+ }
+
+ protected void assertChars(final String expected) {
+ assertChars(expected, 0, expected.length());
+ }
+
+ protected void assertChars(final String expected, final int begin, final int end) {
+ for (int n= 0, index= begin; index < end; n++, index++) {
+ final int index0= index;
+ final char eChar= expected.charAt(index0);
+ final int actual= this.input.get(n);
+ assertEquals(eChar, actual, () -> "characters differ at [" + index0 + "], ");
+ }
+ }
+
+}
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/HtmlStripParserInputTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/HtmlStripParserInputTest.java
index 0dc5a46..51e7435 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/HtmlStripParserInputTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/HtmlStripParserInputTest.java
@@ -14,23 +14,25 @@
package org.eclipse.statet.jcommons.text.core.input;
-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.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.internal.ArrayComparisonFailure;
+import static org.eclipse.statet.jcommons.lang.ObjectUtils.nonNullAssert;
+import org.junit.jupiter.api.Test;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.text.core.util.HtmlStripParserInput;
import org.eclipse.statet.jcommons.text.core.util.HtmlUtils;
import org.eclipse.statet.jcommons.text.core.util.HtmlUtils.Entity;
-@FixMethodOrder
-public class HtmlStripParserInputTest {
+@NonNullByDefault
+public class HtmlStripParserInputTest extends AbstractTextParserInputTest<HtmlStripParserInput> {
- private HtmlStripParserInput input;
+ public HtmlStripParserInputTest() {
+ }
@Test
@@ -135,7 +137,7 @@
public void decodeEntity() {
final String s= Utils.COUNTER_STRING;
final StringBuilder sb= new StringBuilder(s);
- final int entityIdx= replaceByEntity(sb, HtmlUtils.getNamedEntity("angle"));
+ final int entityIdx= replaceByEntity(sb, nonNullAssert(HtmlUtils.getNamedEntity("angle")));
this.input= new HtmlStripParserInput(sb.toString());
this.input.init();
@@ -148,34 +150,4 @@
assertEquals(TextParserInput.EOF, this.input.get(s.length()));
}
-
- protected void readConsume(final String expected, final int[] indexes, int begin, final int end, final int consume) {
- while (begin < end) {
- final int l= Math.min(end - begin, consume);
- assertEquals(indexes[begin], this.input.getIndex());
- assertEquals(0, this.input.getLengthInSource(0));
- assertChars(expected, begin, begin + l);
- assertEquals(indexes[begin + l - 1] + 1 - indexes[begin], this.input.getLengthInSource(l));
- this.input.consume(l);
- begin+= l;
- }
- }
-
- protected void assertChars(final String expected) {
- assertChars(expected, 0, expected.length());
- }
-
- protected void assertChars(final String expected, final int begin, final int end) {
- for (int n= 0, index= begin; index < end; n++, index++) {
- final char eChar= expected.charAt(index);
- final int actual= this.input.get(n);
- try {
- assertEquals(eChar, actual);
- }
- catch (final AssertionError e) {
- throw new ArrayComparisonFailure("char ", e, index);
- }
- }
- }
-
}
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/OffsetStringParserInputTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/OffsetStringParserInputTest.java
index 29b7538..be34d63 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/OffsetStringParserInputTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/OffsetStringParserInputTest.java
@@ -14,19 +14,21 @@
package org.eclipse.statet.jcommons.text.core.input;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.internal.ArrayComparisonFailure;
+import org.junit.jupiter.api.Test;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-@FixMethodOrder
-public class OffsetStringParserInputTest {
+@NonNullByDefault
+public class OffsetStringParserInputTest extends AbstractTextParserInputTest<OffsetStringParserInput> {
- private OffsetStringParserInput input;
+ public OffsetStringParserInputTest() {
+ }
@Test
@@ -39,25 +41,28 @@
assertEquals(200, this.input.getStopIndex());
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initRegionIllegalStart() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new OffsetStringParserInput(s.substring(50), 50);
- this.input.init(49, 400);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(49, 400) );
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initRegionIllegalStop() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new OffsetStringParserInput(s.substring(50), 50);
- this.input.init(50, 801);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(50, 801) );
}
- @Test (expected= IllegalArgumentException.class)
+ @Test
public void initRegionIllegalLength() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new OffsetStringParserInput(s.substring(50), 50);
- this.input.init(800, 400);
+ assertThrows(IllegalArgumentException.class,
+ () -> this.input.init(800, 400) );
}
public void initNegativIndex() {
@@ -66,18 +71,20 @@
this.input.init(-50, 750);
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initNegativIndexInvalidStart() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new OffsetStringParserInput(s, -50);
- this.input.init(-51, 750);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(-51, 750) );
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initNegativIndexInvalidStop() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new OffsetStringParserInput(s, -50);
- this.input.init(-50, 751);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(-50, 751) );
}
@Test
@@ -166,34 +173,4 @@
assertEquals(TextParserInput.EOF, this.input.get(0));
}
-
- protected void readConsume(final String expected, int begin, final int end, final int consume) {
- while (begin < end) {
- final int l= Math.min(end - begin, consume);
- assertEquals(begin, this.input.getIndex());
- assertEquals(0, this.input.getLengthInSource(0));
- assertChars(expected, begin, begin + l);
- assertEquals(l, this.input.getLengthInSource(l));
- this.input.consume(l);
- begin+= l;
- }
- }
-
- protected void assertChars(final String expected) {
- assertChars(expected, 0, expected.length());
- }
-
- protected void assertChars(final String expected, final int begin, final int end) {
- for (int n= 0, index= begin; index < end; n++, index++) {
- final char eChar= expected.charAt(index);
- final int actual= this.input.get(n);
- try {
- assertEquals(eChar, actual);
- }
- catch (final AssertionError e) {
- throw new ArrayComparisonFailure("char ", e, index);
- }
- }
- }
-
}
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/RegionParserInputTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/RegionParserInputTest.java
index e9832a5..013cbbc 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/RegionParserInputTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/RegionParserInputTest.java
@@ -14,21 +14,21 @@
package org.eclipse.statet.jcommons.text.core.input;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.internal.ArrayComparisonFailure;
+import org.junit.jupiter.api.Test;
import org.eclipse.statet.jcommons.collections.ImCollections;
import org.eclipse.statet.jcommons.collections.ImList;
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.text.core.BasicTextRegion;
import org.eclipse.statet.jcommons.text.core.TextRegion;
-@FixMethodOrder
-public class RegionParserInputTest {
+@NonNullByDefault
+public class RegionParserInputTest extends AbstractTextParserInputTest<RegionParserInput> {
private static String createRegionString(final String s, final ImList<? extends TextRegion> regions) {
@@ -56,7 +56,8 @@
}
- private RegionParserInput input;
+ public RegionParserInputTest() {
+ }
@Test
@@ -79,25 +80,28 @@
assertEquals(200, this.input.getStopIndex());
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initRegionIllegalStart() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new RegionParserInput(s, ImCollections.<TextRegion>emptyList());
- this.input.init(-1, 400);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(-1, 400) );
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initRegionIllegalStop() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new RegionParserInput(s, ImCollections.<TextRegion>emptyList());
- this.input.init(0, 801);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(0, 801) );
}
- @Test (expected= IllegalArgumentException.class)
+ @Test
public void initRegionIllegalLength() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new RegionParserInput(s, ImCollections.<TextRegion>emptyList());
- this.input.init(800, 400);
+ assertThrows(IllegalArgumentException.class,
+ () -> this.input.init(800, 400) );
}
@Test
@@ -215,33 +219,4 @@
assertTrue(0x1000 >= Utils.getBufferLength(this.input));
}
- protected void readConsume(final String expected, final int[] indexes, int begin, final int end, final int consume) {
- while (begin < end) {
- final int l= Math.min(end - begin, consume);
- assertEquals(indexes[begin], this.input.getIndex());
- assertEquals(0, this.input.getLengthInSource(0));
- assertChars(expected, begin, begin + l);
- assertEquals(indexes[begin + l - 1] + 1 - indexes[begin], this.input.getLengthInSource(l));
- this.input.consume(l);
- begin+= l;
- }
- }
-
- protected void assertChars(final String expected) {
- assertChars(expected, 0, expected.length());
- }
-
- protected void assertChars(final String expected, final int begin, final int end) {
- for (int n= 0, index= begin; index < end; n++, index++) {
- final char eChar= expected.charAt(index);
- final int actual= this.input.get(n);
- try {
- assertEquals(eChar, actual);
- }
- catch (final AssertionError e) {
- throw new ArrayComparisonFailure("char ", e, index);
- }
- }
- }
-
}
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/StringParserInputTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/StringParserInputTest.java
index 195bf69..88babb8 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/StringParserInputTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/StringParserInputTest.java
@@ -14,19 +14,21 @@
package org.eclipse.statet.jcommons.text.core.input;
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.internal.ArrayComparisonFailure;
+import org.junit.jupiter.api.Test;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-@FixMethodOrder
-public class StringParserInputTest {
+@NonNullByDefault
+public class StringParserInputTest extends AbstractTextParserInputTest<StringParserInput> {
- private StringParserInput input;
+ public StringParserInputTest() {
+ }
@Test
@@ -49,25 +51,28 @@
assertEquals(200, this.input.getStopIndex());
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initRegionIllegalStart() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new StringParserInput(s);
- this.input.init(-1, 400);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(-1, 400) );
}
- @Test (expected= IndexOutOfBoundsException.class)
+ @Test
public void initRegionIllegalStop() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new StringParserInput(s);
- this.input.init(0, 801);
+ assertThrows(IndexOutOfBoundsException.class,
+ () -> this.input.init(0, 801) );
}
- @Test (expected= IllegalArgumentException.class)
+ @Test
public void initRegionIllegalLength() {
final String s= Utils.COUNTER_STRING.substring(0, 800);
this.input= new StringParserInput(s);
- this.input.init(800, 400);
+ assertThrows(IllegalArgumentException.class,
+ () -> this.input.init(800, 400) );
}
@Test
@@ -161,34 +166,4 @@
assertEquals(TextParserInput.EOF, this.input.get(0));
}
-
- protected void readConsume(final String expected, int begin, final int end, final int consume) {
- while (begin < end) {
- final int l= Math.min(end - begin, consume);
- assertEquals(begin, this.input.getIndex());
- assertEquals(0, this.input.getLengthInSource(0));
- assertChars(expected, begin, begin + l);
- assertEquals(l, this.input.getLengthInSource(l));
- this.input.consume(l);
- begin+= l;
- }
- }
-
- protected void assertChars(final String expected) {
- assertChars(expected, 0, expected.length());
- }
-
- protected void assertChars(final String expected, final int begin, final int end) {
- for (int n= 0, index= begin; index < end; n++, index++) {
- final char eChar= expected.charAt(index);
- final int actual= this.input.get(n);
- try {
- assertEquals(eChar, actual);
- }
- catch (final AssertionError e) {
- throw new ArrayComparisonFailure("char ", e, index);
- }
- }
- }
-
}
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/TextParserInputMatchTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/TextParserInputMatchTest.java
index 47d2559..3f667d0 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/TextParserInputMatchTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/TextParserInputMatchTest.java
@@ -14,17 +14,24 @@
package org.eclipse.statet.jcommons.text.core.input;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+@NonNullByDefault
public class TextParserInputMatchTest {
private StringParserInput input;
+ public TextParserInputMatchTest() {
+ }
+
+
@Test
public void get() {
final String s= Utils.COUNTER_STRING;
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/Utils.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/Utils.java
index 8e996e8..78f9a98 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/Utils.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/input/Utils.java
@@ -17,7 +17,10 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+
+@NonNullByDefault
class Utils {
@@ -25,7 +28,7 @@
static {
final char[] test= new char[0x4000];
for (int i= 0; i < test.length; i++) {
- test[i]= (char) i;
+ test[i]= (char)i;
}
COUNTER_STRING= new String(test);
}
@@ -47,7 +50,7 @@
try {
final Method method= TextParserInput.class.getDeclaredMethod("getBuffer");
method.setAccessible(true);
- final char[] buffer= (char[]) method.invoke(input);
+ final char[] buffer= (char[])method.invoke(input);
return buffer.length;
}
catch (final Exception e) {
diff --git a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/util/HtmlUtilsEntityTest.java b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/util/HtmlUtilsEntityTest.java
index 1e7f842..ed80acf 100644
--- a/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/util/HtmlUtilsEntityTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.text.core-tests/src/org/eclipse/statet/jcommons/text/core/util/HtmlUtilsEntityTest.java
@@ -14,8 +14,9 @@
package org.eclipse.statet.jcommons.text.core.util;
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
public class HtmlUtilsEntityTest {
@@ -23,14 +24,14 @@
@Test
public void getEntityName_fromName() {
- Assert.assertEquals("amp", HtmlUtils.getEntityReference("amp"));
+ assertEquals("amp", HtmlUtils.getEntityReference("amp"));
}
@Test
public void getEntityName_fromHtmlEntity() {
- Assert.assertEquals("amp", HtmlUtils.getEntityReference("&"));
+ assertEquals("amp", HtmlUtils.getEntityReference("&"));
- Assert.assertEquals("amp", HtmlUtils.getEntityReference("&"));
+ assertEquals("amp", HtmlUtils.getEntityReference("&"));
}
}
diff --git a/jcommons/org.eclipse.statet.jcommons.util-tests/META-INF/MANIFEST.MF b/jcommons/org.eclipse.statet.jcommons.util-tests/META-INF/MANIFEST.MF
index e0fcb3b..31b1dd3 100644
--- a/jcommons/org.eclipse.statet.jcommons.util-tests/META-INF/MANIFEST.MF
+++ b/jcommons/org.eclipse.statet.jcommons.util-tests/META-INF/MANIFEST.MF
@@ -6,4 +6,4 @@
Bundle-Vendor: Eclipse StatET
Bundle-Name: StatET JCommons - Util - Tests (Incubation)
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.junit;bundle-version="4.12.0"
+Import-Package: org.junit.jupiter.api
diff --git a/jcommons/org.eclipse.statet.jcommons.util-tests/src/org/eclipse/statet/jcommons/collections/IntIntervalArraysTest.java b/jcommons/org.eclipse.statet.jcommons.util-tests/src/org/eclipse/statet/jcommons/collections/IntIntervalArraysTest.java
index 75068bb..d5526dc 100644
--- a/jcommons/org.eclipse.statet.jcommons.util-tests/src/org/eclipse/statet/jcommons/collections/IntIntervalArraysTest.java
+++ b/jcommons/org.eclipse.statet.jcommons.util-tests/src/org/eclipse/statet/jcommons/collections/IntIntervalArraysTest.java
@@ -14,9 +14,9 @@
package org.eclipse.statet.jcommons.collections;
-import static org.junit.Assert.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
@@ -131,7 +131,7 @@
for (int offset= 0; offset < expectedRegions.length; offset++) {
final String id= String.format("[offset= %1$s, length= %2$s]", offset, length);
final int[] actualRegions= IntIntervalArrays.insertBlank(baseRegions.clone(), offset, length);
- assertArrayEquals(id, expectedRegions[offset], actualRegions);
+ assertArrayEquals(expectedRegions[offset], actualRegions, id);
}
}
@@ -238,7 +238,7 @@
for (int offset= 0; offset < expectedRegions.length; offset++) {
final String id= String.format("[offset= %1$s, length= %2$s]", offset, length);
final int[] actualRegions= IntIntervalArrays.insertRegion(baseRegions.clone(), offset, length);
- assertArrayEquals(id, expectedRegions[offset], actualRegions);
+ assertArrayEquals(expectedRegions[offset], actualRegions, id);
}
}
@@ -280,7 +280,7 @@
for (int offset= 0; offset < expectedRegions.length; offset++) {
final String id= String.format("[offset= %1$s]", offset);
final int[] actualRegions= IntIntervalArrays.removeTail(baseRegions.clone(), offset);
- assertArrayEquals(id, expectedRegions[offset], actualRegions);
+ assertArrayEquals(expectedRegions[offset], actualRegions, id);
}
}