|
1 | 1 | package org.nibor.autolink;
|
2 | 2 |
|
3 |
| -import org.junit.Test; |
4 |
| -import org.junit.runner.RunWith; |
5 |
| -import org.junit.runners.Parameterized; |
6 |
| -import org.junit.runners.Parameterized.Parameter; |
7 |
| -import org.junit.runners.Parameterized.Parameters; |
| 3 | +import org.junit.jupiter.api.Test; |
| 4 | +import org.junit.jupiter.params.Parameter; |
| 5 | +import org.junit.jupiter.params.ParameterizedClass; |
| 6 | +import org.junit.jupiter.params.provider.Arguments; |
| 7 | +import org.junit.jupiter.params.provider.MethodSource; |
8 | 8 |
|
9 |
| -import java.util.Arrays; |
10 | 9 | import java.util.EnumSet;
|
| 10 | +import java.util.Set; |
| 11 | +import java.util.stream.Stream; |
11 | 12 |
|
12 |
| -import static org.junit.Assert.assertEquals; |
| 13 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 14 | +import static org.junit.jupiter.params.provider.Arguments.arguments; |
13 | 15 |
|
14 |
| -@RunWith(Parameterized.class) |
| 16 | +@ParameterizedClass |
| 17 | +@MethodSource("data") |
15 | 18 | public class AutolinkUrlTest extends AutolinkTestCase {
|
16 | 19 |
|
17 |
| - @Parameters(name = "{1}") |
18 |
| - public static Iterable<Object[]> data() { |
19 |
| - return Arrays.asList(new Object[][]{ |
20 |
| - {LinkExtractor.builder().linkTypes(EnumSet.of(LinkType.URL)).build(), "URL"}, |
21 |
| - {LinkExtractor.builder().linkTypes(EnumSet.allOf(LinkType.class)).build(), "all"} |
22 |
| - }); |
| 20 | + public static Stream<Arguments> data() { |
| 21 | + return Stream.of( |
| 22 | + arguments(EnumSet.of(LinkType.URL)), |
| 23 | + arguments(EnumSet.allOf(LinkType.class)) |
| 24 | + ); |
23 | 25 | }
|
24 | 26 |
|
25 |
| - @Parameter(0) |
26 |
| - public LinkExtractor linkExtractor; |
27 |
| - |
28 |
| - @Parameter(1) |
29 |
| - public String description; |
| 27 | + @Parameter |
| 28 | + public Set<LinkType> linkTypes; |
30 | 29 |
|
31 | 30 | @Test
|
32 | 31 | public void notLinked() {
|
@@ -197,24 +196,24 @@ public void international() {
|
197 | 196 |
|
198 | 197 | @Test
|
199 | 198 | public void unicodeWhitespace() {
|
200 |
| - char[] whitespace = new char[] { |
201 |
| - '\u00A0', // no-break space |
202 |
| - '\u2000', // en quad |
203 |
| - '\u2001', // em quad |
204 |
| - '\u2002', // en space |
205 |
| - '\u2003', // em space |
206 |
| - '\u2004', // three-per-em space |
207 |
| - '\u2005', // four-per-em space |
208 |
| - '\u2006', // six-per-em space |
209 |
| - '\u2007', // figure space |
210 |
| - '\u2008', // punctuation space |
211 |
| - '\u2009', // thin space |
212 |
| - '\u200A', // hair space |
213 |
| - '\u2028', // line separator |
214 |
| - '\u2029', // paragraph separator |
215 |
| - '\u202F', // narrow no-break space |
216 |
| - '\u205F', // medium mathematical space |
217 |
| - '\u3000', // ideographic space |
| 199 | + char[] whitespace = new char[]{ |
| 200 | + '\u00A0', // no-break space |
| 201 | + '\u2000', // en quad |
| 202 | + '\u2001', // em quad |
| 203 | + '\u2002', // en space |
| 204 | + '\u2003', // em space |
| 205 | + '\u2004', // three-per-em space |
| 206 | + '\u2005', // four-per-em space |
| 207 | + '\u2006', // six-per-em space |
| 208 | + '\u2007', // figure space |
| 209 | + '\u2008', // punctuation space |
| 210 | + '\u2009', // thin space |
| 211 | + '\u200A', // hair space |
| 212 | + '\u2028', // line separator |
| 213 | + '\u2029', // paragraph separator |
| 214 | + '\u202F', // narrow no-break space |
| 215 | + '\u205F', // medium mathematical space |
| 216 | + '\u3000', // ideographic space |
218 | 217 | };
|
219 | 218 |
|
220 | 219 | for (char c : whitespace) {
|
@@ -242,7 +241,7 @@ public void linkToString() {
|
242 | 241 |
|
243 | 242 | @Override
|
244 | 243 | protected LinkExtractor getLinkExtractor() {
|
245 |
| - return linkExtractor; |
| 244 | + return LinkExtractor.builder().linkTypes(linkTypes).build(); |
246 | 245 | }
|
247 | 246 |
|
248 | 247 | protected void assertLinked(String input, String expected) {
|
|
0 commit comments