Skip to content

[Backport stable-16.10.x] [Misc] Migrate XWikiReferenceParserTest to Junit 5 #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,32 @@
*/
package org.xwiki.rendering.wikimodel.test;

import org.junit.jupiter.api.Test;
import org.xwiki.rendering.wikimodel.WikiParameters;
import org.xwiki.rendering.wikimodel.WikiReference;
import org.xwiki.rendering.wikimodel.xwiki.xwiki20.XWikiReferenceParser;

import org.junit.Assert;
import junit.framework.TestCase;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

/**
* @version $Id$
* @since 4.0M1
*/
public class XWikiReferenceParserTest extends TestCase
class XWikiReferenceParserTest
{
public void testParseReferenceWhenReferenceOnly()
@Test
void parseReferenceWhenReferenceOnly()
{
XWikiReferenceParser parser = new XWikiReferenceParser();
WikiReference reference = parser.parse("reference");
assertNull(reference.getLabel());
Assert.assertEquals(WikiParameters.EMPTY, reference.getParameters());
assertEquals(WikiParameters.EMPTY, reference.getParameters());
assertEquals("reference", reference.getLink());
}

public void testParseReferenceWhenLabelSpecified()
@Test
void parseReferenceWhenLabelSpecified()
{
XWikiReferenceParser parser = new XWikiReferenceParser();
WikiReference reference = parser.parse("label>>reference");
Expand All @@ -50,7 +53,8 @@ public void testParseReferenceWhenLabelSpecified()
assertEquals("reference", reference.getLink());
}

public void testParseReferenceWhenParametersSpecified()
@Test
void parseReferenceWhenParametersSpecified()
{

XWikiReferenceParser parser = new XWikiReferenceParser();
Expand All @@ -69,7 +73,8 @@ public void testParseReferenceWhenParametersSpecified()
assertEquals("reference", reference.getLink());
}

public void testParseReferenceWhenLabelAndParametersSpecified()
@Test
void parseReferenceWhenLabelAndParametersSpecified()
{
XWikiReferenceParser parser = new XWikiReferenceParser();
WikiReference reference = parser.parse("label>>reference||param=value");
Expand All @@ -81,7 +86,8 @@ public void testParseReferenceWhenLabelAndParametersSpecified()
assertEquals("reference", reference.getLink());
}

public void testParseReferenceWithGreaterThanSymbolInLabel()
@Test
void parseReferenceWithGreaterThanSymbolInLabel()
{
XWikiReferenceParser parser = new XWikiReferenceParser();
WikiReference reference = parser
Expand All @@ -90,7 +96,8 @@ public void testParseReferenceWithGreaterThanSymbolInLabel()
assertEquals("reference", reference.getLink());
}

public void testParseReferenceWithPipeSymbolInLink()
@Test
void parseReferenceWithPipeSymbolInLink()
{
XWikiReferenceParser parser = new XWikiReferenceParser();
WikiReference reference = parser.parse("reference|||param=value");
Expand All @@ -101,7 +108,8 @@ public void testParseReferenceWithPipeSymbolInLink()
.getValue());
}

public void testParseReferenceWhenLabelAndParametersSpecifiedWithSomeEscaping()
@Test
void parseReferenceWhenLabelAndParametersSpecifiedWithSomeEscaping()
{
XWikiReferenceParser parser = new XWikiReferenceParser();
WikiReference reference = parser
Expand All @@ -114,7 +122,8 @@ public void testParseReferenceWhenLabelAndParametersSpecifiedWithSomeEscaping()
assertEquals("refe||rence", reference.getLink());
}

public void testParseReferenceWhenLabelAndParametersSpecifiedWithSomeEscapingAndInternalLink()
@Test
void parseReferenceWhenLabelAndParametersSpecifiedWithSomeEscapingAndInternalLink()
{
XWikiReferenceParser parser = new XWikiReferenceParser();
WikiReference reference = parser
Expand Down