You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2018/10/26 19:47:33 UTC
[jspwiki] 03/06: Upgrade to JUnit 5 (III):
This is an automated email from the ASF dual-hosted git repository.
juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git
commit 92c51d9853aaea5c4176b391d4da5550035809cf
Author: juanpablo <ju...@apache.org>
AuthorDate: Fri Oct 26 21:01:49 2018 +0200
Upgrade to JUnit 5 (III):
* replaced all import, annotations and asserts via 'find . -name *java -type f -exec sed'-like expressions
* manually replaced all Assert.assertXXX(msg, expected, actual) with their equivalent Assertions.assertXXX( expected, actual, msg ) [especially funny when expected and actual are Strings]
---
.../apache/wiki/render/MarkdownRendererTest.java | 64 +--
.../test/java/org/apache/wiki/PageManagerTest.java | 16 +-
.../test/java/org/apache/wiki/PageSorterTest.java | 18 +-
.../java/org/apache/wiki/PropertyReaderTest.java | 36 +-
.../java/org/apache/wiki/ReferenceManagerTest.java | 158 ++++---
.../src/test/java/org/apache/wiki/ReleaseTest.java | 38 +-
.../java/org/apache/wiki/VariableManagerTest.java | 36 +-
.../java/org/apache/wiki/WikiAjaxServletTest.java | 18 +-
.../test/java/org/apache/wiki/WikiEngineTest.java | 255 +++++------
.../test/java/org/apache/wiki/WikiSessionTest.java | 98 ++---
.../wiki/attachment/AttachmentManagerTest.java | 126 +++---
.../wiki/auth/AuthenticationManagerTest.java | 100 ++---
.../apache/wiki/auth/AuthorizationManagerTest.java | 474 ++++++++++-----------
.../org/apache/wiki/auth/GroupManagerTest.java | 100 ++---
.../java/org/apache/wiki/auth/UserManagerTest.java | 176 ++++----
.../org/apache/wiki/auth/acl/AclEntryImplTest.java | 36 +-
.../java/org/apache/wiki/auth/acl/AclImplTest.java | 74 ++--
.../wiki/auth/acl/DefaultAclManagerTest.java | 114 ++---
.../org/apache/wiki/auth/authorize/GroupTest.java | 40 +-
.../wiki/auth/authorize/JDBCGroupDatabaseTest.java | 98 ++---
.../auth/authorize/WebContainerAuthorizerTest.java | 26 +-
.../wiki/auth/authorize/XMLGroupDatabaseTest.java | 92 ++--
.../wiki/auth/login/AnonymousLoginModuleTest.java | 30 +-
.../auth/login/CookieAssertionLoginModuleTest.java | 32 +-
.../auth/login/UserDatabaseLoginModuleTest.java | 38 +-
.../auth/login/WebContainerLoginModuleTest.java | 34 +-
.../permissions/AllPermissionCollectionTest.java | 174 ++++----
.../wiki/auth/permissions/AllPermissionTest.java | 48 +--
.../wiki/auth/permissions/GroupPermissionTest.java | 170 ++++----
.../wiki/auth/permissions/PagePermissionTest.java | 264 ++++++------
.../wiki/auth/permissions/WikiPermissionTest.java | 108 ++---
.../wiki/auth/user/JDBCUserDatabaseTest.java | 220 +++++-----
.../org/apache/wiki/auth/user/UserProfileTest.java | 48 +--
.../apache/wiki/auth/user/XMLUserDatabaseTest.java | 190 ++++-----
.../org/apache/wiki/content/PageRenamerTest.java | 132 +++---
.../wiki/diff/ContextualDiffProviderTest.java | 12 +-
.../wiki/filters/DefaultFilterManagerTest.java | 30 +-
.../htmltowiki/HtmlStringToWikiTranslatorTest.java | 162 +++----
.../wiki/i18n/InternationalizationManagerTest.java | 12 +-
.../wiki/parser/CreoleToJSPWikiTranslatorTest.java | 184 ++++----
.../wiki/parser/JSPWikiMarkupParserTest.java | 473 ++++++++++----------
.../org/apache/wiki/parser/MarkupParserTest.java | 10 +-
.../org/apache/wiki/plugin/CounterPluginTest.java | 26 +-
.../wiki/plugin/DefaultPluginManagerTest.java | 42 +-
.../java/org/apache/wiki/plugin/GroupsTest.java | 14 +-
.../java/org/apache/wiki/plugin/IfPluginTest.java | 28 +-
.../org/apache/wiki/plugin/InsertPageTest.java | 28 +-
.../org/apache/wiki/plugin/PageViewPluginTest.java | 26 +-
.../wiki/plugin/RecentChangesPluginTest.java | 40 +-
.../wiki/plugin/ReferringPagesPluginTest.java | 61 ++-
.../plugin/ReferringUndefinedPagesPluginTest.java | 34 +-
.../apache/wiki/plugin/TableOfContentsTest.java | 46 +-
.../wiki/plugin/UndefinedPagesPluginTest.java | 18 +-
.../providers/BasicAttachmentProviderTest.java | 62 +--
.../apache/wiki/providers/CachingProviderTest.java | 26 +-
.../wiki/providers/FileSystemProviderTest.java | 67 ++-
.../wiki/providers/VersioningFileProviderTest.java | 161 ++++---
.../org/apache/wiki/render/CreoleRendererTest.java | 46 +-
.../apache/wiki/render/RenderingManagerTest.java | 16 +-
.../wiki/render/WysiwygEditingRendererTest.java | 28 +-
.../java/org/apache/wiki/rss/RSSGeneratorTest.java | 20 +-
.../org/apache/wiki/search/SearchManagerTest.java | 58 +--
.../apache/wiki/stress/MassiveRepositoryTest.java | 16 +-
.../wiki/stress/StressTestVersioningProvider.java | 27 +-
.../org/apache/wiki/ui/CommandResolverTest.java | 118 ++---
.../java/org/apache/wiki/ui/GroupCommandTest.java | 88 ++--
.../org/apache/wiki/ui/InputValidatorTest.java | 50 +--
.../java/org/apache/wiki/ui/PageCommandTest.java | 102 ++---
.../org/apache/wiki/ui/RedirectCommandTest.java | 40 +-
.../java/org/apache/wiki/ui/WikiCommandTest.java | 178 ++++----
.../apache/wiki/ui/admin/beans/FilterBeanTest.java | 6 +-
.../apache/wiki/ui/admin/beans/PluginBeanTest.java | 6 +-
.../apache/wiki/url/DefaultURLConstructorTest.java | 30 +-
.../apache/wiki/url/ShortURLConstructorTest.java | 30 +-
.../wiki/url/ShortViewURLConstructorTest.java | 30 +-
.../java/org/apache/wiki/util/ByteUtilsTest.java | 18 +-
.../java/org/apache/wiki/util/ClassUtilTest.java | 34 +-
.../apache/wiki/util/CommentedPropertiesTest.java | 66 +--
.../java/org/apache/wiki/util/CryptoUtilTest.java | 42 +-
.../java/org/apache/wiki/util/FileUtilTest.java | 20 +-
.../java/org/apache/wiki/util/MailUtilTest.java | 28 +-
.../org/apache/wiki/util/PriorityListTest.java | 60 +--
.../org/apache/wiki/util/PropertyReaderTest.java | 20 +-
.../java/org/apache/wiki/util/SerializerTest.java | 14 +-
.../java/org/apache/wiki/util/TextUtilTest.java | 126 +++---
.../org/apache/wiki/util/TimedCounterListTest.java | 22 +-
.../java/org/apache/wiki/util/XmlUtilTest.java | 32 +-
.../wiki/util/comparators/HumanComparatorTest.java | 38 +-
.../apache/wiki/workflow/ApprovalWorkflowTest.java | 122 +++---
.../apache/wiki/workflow/DecisionQueueTest.java | 66 +--
.../java/org/apache/wiki/workflow/FactTest.java | 16 +-
.../java/org/apache/wiki/workflow/OutcomeTest.java | 68 +--
.../apache/wiki/workflow/SimpleDecisionTest.java | 76 ++--
.../java/org/apache/wiki/workflow/TaskTest.java | 74 ++--
.../apache/wiki/workflow/WorkflowManagerTest.java | 46 +-
.../org/apache/wiki/workflow/WorkflowTest.java | 162 +++----
.../org/apache/wiki/xmlrpc/RPCHandlerTest.java | 51 ++-
97 files changed, 3615 insertions(+), 3718 deletions(-)
diff --git a/jspwiki-markdown/src/test/java/org/apache/wiki/render/MarkdownRendererTest.java b/jspwiki-markdown/src/test/java/org/apache/wiki/render/MarkdownRendererTest.java
index d6f9be1..58b05b6 100755
--- a/jspwiki-markdown/src/test/java/org/apache/wiki/render/MarkdownRendererTest.java
+++ b/jspwiki-markdown/src/test/java/org/apache/wiki/render/MarkdownRendererTest.java
@@ -32,10 +32,10 @@ import org.apache.wiki.api.exceptions.WikiException;
import org.apache.wiki.attachment.Attachment;
import org.apache.wiki.parser.markdown.MarkdownParser;
import org.apache.wiki.render.markdown.MarkdownRenderer;
-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 net.sf.ehcache.CacheManager;
@@ -53,7 +53,7 @@ public class MarkdownRendererTest {
public void testMarkupSimpleMarkdown() throws Exception {
String src = "This should be a **bold**";
- Assert.assertEquals( "<p>This should be a <strong>bold</strong></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>This should be a <strong>bold</strong></p>\n", translate( src ) );
}
@Test
@@ -61,7 +61,7 @@ public class MarkdownRendererTest {
newPage( "MarkupExtensionSelfViewLink" );
String src = "This should be a [MarkupExtensionSelfViewLink]()";
- Assert.assertEquals( "<p>This should be a <a href=\"/test/Wiki.jsp?page=MarkupExtensionSelfViewLink\" class=\"wikipage\">MarkupExtensionSelfViewLink</a></p>\n",
+ Assertions.assertEquals( "<p>This should be a <a href=\"/test/Wiki.jsp?page=MarkupExtensionSelfViewLink\" class=\"wikipage\">MarkupExtensionSelfViewLink</a></p>\n",
translate( src ) );
}
@@ -69,7 +69,7 @@ public class MarkdownRendererTest {
public void testMarkupExtensionSelfEditLink() throws Exception {
String src = "This should be a [self<->link]()";
- Assert.assertEquals( "<p>This should be a <a href=\"/test/Edit.jsp?page=self%3C-%3Elink\" title=\"Create "self<->link"\" class=\"createpage\">self<->link</a></p>\n",
+ Assertions.assertEquals( "<p>This should be a <a href=\"/test/Edit.jsp?page=self%3C-%3Elink\" title=\"Create "self<->link"\" class=\"createpage\">self<->link</a></p>\n",
translate( src ) );
}
@@ -78,7 +78,7 @@ public class MarkdownRendererTest {
testEngine.getWikiProperties().setProperty( "jspwiki.translatorReader.useOutlinkImage", "true" );
String src = "This should be an [external link](https://jspwiki.apache.org)";
- Assert.assertEquals( "<p>This should be an <a href=\"https://jspwiki.apache.org\" class=\"external\">external link</a><img class=\"outlink\" alt=\"\" src=\"/test/images/out.png\" /></p>\n",
+ Assertions.assertEquals( "<p>This should be an <a href=\"https://jspwiki.apache.org\" class=\"external\">external link</a><img class=\"outlink\" alt=\"\" src=\"/test/images/out.png\" /></p>\n",
translate( src ) );
testEngine.getWikiProperties().remove( "jspwiki.translatorReader.useOutlinkImage" );
}
@@ -87,7 +87,7 @@ public class MarkdownRendererTest {
public void testMarkupExtensionInterWikiLink() throws Exception {
String src = "This should be an [interwiki link](JSPWiki:About)";
- Assert.assertEquals( "<p>This should be an <a href=\"http://jspwiki-wiki.apache.org/Wiki.jsp?page=About\" class=\"interwiki\">interwiki link</a></p>\n",
+ Assertions.assertEquals( "<p>This should be an <a href=\"http://jspwiki-wiki.apache.org/Wiki.jsp?page=About\" class=\"interwiki\">interwiki link</a></p>\n",
translate( src ) );
}
@@ -95,7 +95,7 @@ public class MarkdownRendererTest {
public void testMarkupExtensionWrongInterWikiLink() throws Exception {
String src = "This should be an [interwiki link](JSPWiko:About)";
- Assert.assertEquals( "<p>This should be an <span class=\"error\">No InterWiki reference defined in properties for Wiki called \"JSPWiko\"!</span></p>\n",
+ Assertions.assertEquals( "<p>This should be an <span class=\"error\">No InterWiki reference defined in properties for Wiki called \"JSPWiko\"!</span></p>\n",
translate( src ) );
}
@@ -103,23 +103,23 @@ public class MarkdownRendererTest {
public void testMarkupExtensionACL() throws Exception {
String src = "[{ALLOW view PerryMason}]() This should be visible if the ACL allows you to see it";
// text is seen because although ACL is added to the page, it is not applied while parsing / rendering
- Assert.assertEquals( "<p> This should be visible if the ACL allows you to see it</p>\n", translate( src ) );
+ Assertions.assertEquals( "<p> This should be visible if the ACL allows you to see it</p>\n", translate( src ) );
// in any case, we also check that the created wikipage has the ACL added
- Assert.assertEquals( " user = PerryMason: ((\"org.apache.wiki.auth.permissions.PagePermission\",\"JSPWiki:testpage\",\"view\"))\n",
+ Assertions.assertEquals( " user = PerryMason: ((\"org.apache.wiki.auth.permissions.PagePermission\",\"JSPWiki:testpage\",\"view\"))\n",
testEngine.getPage( PAGE_NAME ).getAcl().toString() );
}
@Test
public void testMarkupExtensionMetadata() throws Exception {
String src = "[{SET Perry='Mason'}]() Some text after setting metadata";
- Assert.assertEquals( "<p> Some text after setting metadata</p>\n", translate( src ) );
- Assert.assertEquals( "Mason", testEngine.getPage( PAGE_NAME ).getAttribute( "Perry" ) );
+ Assertions.assertEquals( "<p> Some text after setting metadata</p>\n", translate( src ) );
+ Assertions.assertEquals( "Mason", testEngine.getPage( PAGE_NAME ).getAttribute( "Perry" ) );
}
@Test
public void testMarkupExtensionPlugin() throws Exception {
String src = "[{SamplePlugin text=test}]()";
- Assert.assertEquals( "<p>test</p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>test</p>\n", translate( src ) );
}
@Test
@@ -128,7 +128,7 @@ public class MarkdownRendererTest {
"# Header 1\n" +
"## Header 2\n" +
"## Header 2\n";
- Assert.assertEquals( "<p><div class=\"toc\">\n" +
+ Assertions.assertEquals( "<p><div class=\"toc\">\n" +
"<div class=\"collapsebox\">\n" +
"<h4 id=\"section-TOC\">Table of Contents</h4>\n" +
"<ul>\n" +
@@ -150,25 +150,25 @@ public class MarkdownRendererTest {
@Test
public void testMarkupExtensionNonExistentPlugin() throws Exception {
String src = "[{PampleSlugin text=test}]()";
- Assert.assertEquals( "<p><span class=\"error\">JSPWiki : testpage - Plugin insertion failed: Could not find plugin PampleSlugin</span></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p><span class=\"error\">JSPWiki : testpage - Plugin insertion failed: Could not find plugin PampleSlugin</span></p>\n", translate( src ) );
}
@Test
public void testMarkupExtensionVariable0() throws Exception {
String src = "Some text with some pre-set variable: [{$applicationname}]()";
- Assert.assertEquals( "<p>Some text with some pre-set variable: JSPWiki</p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>Some text with some pre-set variable: JSPWiki</p>\n", translate( src ) );
}
@Test
public void testMarkupExtensionVariable1() throws Exception {
String src = "[{SET Perry='Mason'}]() Some text after setting some metadata: [{$Perry}]()";
- Assert.assertEquals( "<p> Some text after setting some metadata: Mason</p>\n", translate( src ) );
+ Assertions.assertEquals( "<p> Some text after setting some metadata: Mason</p>\n", translate( src ) );
}
@Test
public void testMarkupExtensionFootnote0() throws Exception {
String src = "Footnote[1]()";
- Assert.assertEquals( "<p>Footnote<a href=\"#ref-testpage-1\" class=\"footnoteref\">[1]</a></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>Footnote<a href=\"#ref-testpage-1\" class=\"footnoteref\">[1]</a></p>\n", translate( src ) );
}
@Test
@@ -176,7 +176,7 @@ public class MarkdownRendererTest {
String src = "text [^footnote] embedded.\n\n" +
"[^footnote]: footnote text\n" +
"with continuation";
- Assert.assertEquals( "<p>text <sup id=\"fnref-1\"><a class=\"footnoteref\" href=\"#fn-1\">1</a></sup> embedded.</p>\n" +
+ Assertions.assertEquals( "<p>text <sup id=\"fnref-1\"><a class=\"footnoteref\" href=\"#fn-1\">1</a></sup> embedded.</p>\n" +
"<div class=\"footnotes\">\n" +
"<hr />\n" +
"<ol>\n" +
@@ -198,7 +198,7 @@ public class MarkdownRendererTest {
att.setAuthor( "FirstPost" );
testEngine.getAttachmentManager().storeAttachment( att, testEngine.makeAttachmentFile() );
- Assert.assertEquals( "<p>This should be an <a href=\"/test/attach/Test/TestAtt.txt\" class=\"attachment\">attachment link</a>" +
+ Assertions.assertEquals( "<p>This should be an <a href=\"/test/attach/Test/TestAtt.txt\" class=\"attachment\">attachment link</a>" +
"<a href=\"/test/PageInfo.jsp?page=Test/TestAtt.txt\" class=\"infolink\">" +
"<img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" />" +
"</a></p>\n",
@@ -209,28 +209,28 @@ public class MarkdownRendererTest {
public void testInlineImages() throws Exception {
String src = "Link [test](http://www.ecyrd.com/test.png)";
- Assert.assertEquals( "<p>Link <img class=\"inline\" src=\"http://www.ecyrd.com/test.png\" alt=\"test\" /></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>Link <img class=\"inline\" src=\"http://www.ecyrd.com/test.png\" alt=\"test\" /></p>\n", translate( src ) );
}
@Test
public void testInlineImages2() throws Exception {
String src = "Link [test](http://www.ecyrd.com/test.ppm)";
- Assert.assertEquals( "<p>Link <a href=\"http://www.ecyrd.com/test.ppm\" class=\"external\">test</a></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>Link <a href=\"http://www.ecyrd.com/test.ppm\" class=\"external\">test</a></p>\n", translate( src ) );
}
@Test
public void testInlineImages3() throws Exception {
String src = "Link [test](http://images.com/testi)";
- Assert.assertEquals( "<p>Link <img class=\"inline\" src=\"http://images.com/testi\" alt=\"test\" /></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>Link <img class=\"inline\" src=\"http://images.com/testi\" alt=\"test\" /></p>\n", translate( src ) );
}
@Test
public void testInlineImages4() throws Exception {
String src = "Link [test](http://foobar.jpg)";
- Assert.assertEquals( "<p>Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"test\" /></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"test\" /></p>\n", translate( src ) );
}
// No link text should be just embedded link.
@@ -238,14 +238,14 @@ public class MarkdownRendererTest {
public void testInlineImagesLink2() throws Exception {
String src = "Link [http://foobar.jpg]()";
- Assert.assertEquals( "<p>Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://foobar.jpg\" /></p>\n", translate( src ) );
+ Assertions.assertEquals( "<p>Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://foobar.jpg\" /></p>\n", translate( src ) );
}
@Test
public void testInlineImagesLink() throws Exception {
String src = "Link [http://link.to/](http://foobar.jpg)";
- Assert.assertEquals( "<p>Link <a href=\"http://link.to/\" class=\"external\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://link.to/\" /></a></p>\n",
+ Assertions.assertEquals( "<p>Link <a href=\"http://link.to/\" class=\"external\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://link.to/\" /></a></p>\n",
translate( src ) );
}
@@ -255,7 +255,7 @@ public class MarkdownRendererTest {
newPage( "SandBox" );
- Assert.assertEquals( "<p>Link <a href=\"/test/Wiki.jsp?page=SandBox\" class=\"wikipage\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"SandBox\" /></a></p>\n",
+ Assertions.assertEquals( "<p>Link <a href=\"/test/Wiki.jsp?page=SandBox\" class=\"wikipage\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"SandBox\" /></a></p>\n",
translate( src ) );
}
@@ -264,12 +264,12 @@ public class MarkdownRendererTest {
String src = "### Awesome H3\n" +
"### Awesome H3";
- Assert.assertEquals( "<h3 id=\"awesome-h3\">Awesome H3</h3>\n" +
+ Assertions.assertEquals( "<h3 id=\"awesome-h3\">Awesome H3</h3>\n" +
"<h3 id=\"awesome-h3-1\">Awesome H3</h3>\n",
translate( src ) );
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
CacheManager.getInstance().removeAllCaches();
props.setProperty( "jspwiki.translatorReader.matchEnglishPlurals", "true" );
@@ -279,7 +279,7 @@ public class MarkdownRendererTest {
testEngine = new TestEngine( props );
}
- @After
+ @AfterEach
public void tearDown() {
for( String name : created ) {
testEngine.deleteTestPage(name);
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/PageManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/PageManagerTest.java
index d653bf8..2afc095 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/PageManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/PageManagerTest.java
@@ -22,10 +22,10 @@ import java.util.Properties;
import org.apache.log4j.PropertyConfigurator;
import org.apache.wiki.providers.CachingProvider;
-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;
public class PageManagerTest
{
@@ -33,7 +33,7 @@ public class PageManagerTest
TestEngine engine;
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -41,7 +41,7 @@ public class PageManagerTest
engine = new TestEngine(props);
}
- @After
+ @AfterEach
public void tearDown()
{
}
@@ -53,7 +53,7 @@ public class PageManagerTest
props.setProperty( "jspwiki.usePageCache", "true" );
PageManager m = new PageManager( engine, props );
- Assert.assertTrue( m.getProvider() instanceof CachingProvider );
+ Assertions.assertTrue( m.getProvider() instanceof CachingProvider );
}
@Test
@@ -63,7 +63,7 @@ public class PageManagerTest
props.setProperty( "jspwiki.usePageCache", "false" );
PageManager m = new PageManager( engine, props );
- Assert.assertTrue( !(m.getProvider() instanceof CachingProvider) );
+ Assertions.assertTrue( !(m.getProvider() instanceof CachingProvider) );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/PageSorterTest.java b/jspwiki-war/src/test/java/org/apache/wiki/PageSorterTest.java
index faed63f..addaa31 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/PageSorterTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/PageSorterTest.java
@@ -21,8 +21,8 @@ package org.apache.wiki;
import java.util.Properties;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
import org.apache.wiki.util.comparators.HumanComparator;
import org.apache.wiki.util.comparators.LocaleComparator;
@@ -44,7 +44,7 @@ public class PageSorterTest
Properties props = new Properties();
props.put( PageSorter.PROP_PAGE_NAME_COMPARATOR, "haha.this.isnt.a.class" );
sorter.initialize( props );
- Assert.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
+ Assertions.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
}
@Test
@@ -52,7 +52,7 @@ public class PageSorterTest
{
// Check uninitialised behaviour
PageSorter sorter = new PageSorter();
- Assert.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
+ Assertions.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
}
@Test
@@ -63,10 +63,10 @@ public class PageSorterTest
Properties props = new Properties();
props.put( PageSorter.PROP_PAGE_NAME_COMPARATOR, HumanComparator.class.getPackage().getName() + ".HumanComparator" );
sorter.initialize( props );
- Assert.assertTrue( sorter.compare( "ab2", "ab10" ) < 0 );
+ Assertions.assertTrue( sorter.compare( "ab2", "ab10" ) < 0 );
props.put( PageSorter.PROP_PAGE_NAME_COMPARATOR, "HumanComparator" );
sorter.initialize( props );
- Assert.assertTrue( sorter.compare( "ab2", "ab10" ) < 0 );
+ Assertions.assertTrue( sorter.compare( "ab2", "ab10" ) < 0 );
}
@Test
@@ -77,10 +77,10 @@ public class PageSorterTest
Properties props = new Properties();
props.put( PageSorter.PROP_PAGE_NAME_COMPARATOR, LocaleComparator.class.getPackage().getName() + ".LocaleComparator" );
sorter.initialize( props );
- Assert.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
+ Assertions.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
props.put( PageSorter.PROP_PAGE_NAME_COMPARATOR, "LocaleComparator" );
sorter.initialize( props );
- Assert.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
+ Assertions.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
}
@Test
@@ -90,6 +90,6 @@ public class PageSorterTest
PageSorter sorter = new PageSorter();
Properties props = new Properties();
sorter.initialize( props );
- Assert.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
+ Assertions.assertTrue( sorter.compare( "ab2", "ab10" ) > 0 );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/PropertyReaderTest.java b/jspwiki-war/src/test/java/org/apache/wiki/PropertyReaderTest.java
index 2b5f8a7..b665127 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/PropertyReaderTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/PropertyReaderTest.java
@@ -21,8 +21,8 @@ package org.apache.wiki;
import java.util.Properties;
import org.apache.wiki.util.PropertyReader;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class PropertyReaderTest
{
@@ -40,13 +40,13 @@ public class PropertyReaderTest
PropertyReader.expandVars(p);
- Assert.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
- Assert.assertTrue( p.getProperty("jspwiki.basicAttachmentProvider.storageDir").equals("/p/mywiki/www/") );
- Assert.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
- Assert.assertTrue( p.getProperty("jspwiki.workDir").endsWith("/p/mywiki/wrk/") );
- Assert.assertTrue( p.getProperty("jspwiki.xyz").endsWith("test basedir") ); //don't touch this
+ Assertions.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.basicAttachmentProvider.storageDir").equals("/p/mywiki/www/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.workDir").endsWith("/p/mywiki/wrk/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.xyz").endsWith("test basedir") ); //don't touch this
- Assert.assertFalse( p.getProperty("jspwiki.workDir").endsWith("$basedir/wrk/") );
+ Assertions.assertFalse( p.getProperty("jspwiki.workDir").endsWith("$basedir/wrk/") );
}
@Test
@@ -68,14 +68,14 @@ public class PropertyReaderTest
PropertyReader.expandVars(p);
- Assert.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
- Assert.assertTrue( p.getProperty("jspwiki.basicAttachmentProvider.storageDir").equals("/p/mywiki/www/") );
- Assert.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
- Assert.assertTrue( p.getProperty("jspwiki.workDir").endsWith("/p/mywiki/wrk/") );
- Assert.assertTrue( p.getProperty("jspwiki.xyz").endsWith("test basedir") ); //don't touch this
+ Assertions.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.basicAttachmentProvider.storageDir").equals("/p/mywiki/www/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.fileSystemProvider.pageDir").equals("/p/mywiki/www/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.workDir").endsWith("/p/mywiki/wrk/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.xyz").endsWith("test basedir") ); //don't touch this
- Assert.assertFalse( p.getProperty("jspwiki.workDir").endsWith("$basedir/wrk/") );
- Assert.assertTrue( p.getProperty("jspwiki.abc").endsWith("test wiki") );
+ Assertions.assertFalse( p.getProperty("jspwiki.workDir").endsWith("$basedir/wrk/") );
+ Assertions.assertTrue( p.getProperty("jspwiki.abc").endsWith("test wiki") );
}
@@ -95,9 +95,9 @@ public class PropertyReaderTest
PropertyReader.expandVars(p);
- Assert.assertTrue( p.getProperty("jspwiki.x1").equals("a") );
- Assert.assertTrue( p.getProperty("jspwiki.x2").equals("b") );
- Assert.assertTrue( p.getProperty("jspwiki.x3").equals("a/b") );
+ Assertions.assertTrue( p.getProperty("jspwiki.x1").equals("a") );
+ Assertions.assertTrue( p.getProperty("jspwiki.x2").equals("b") );
+ Assertions.assertTrue( p.getProperty("jspwiki.x3").equals("a/b") );
}
}
\ No newline at end of file
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/ReferenceManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/ReferenceManagerTest.java
index 4463dc8..3fde3ee 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/ReferenceManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/ReferenceManagerTest.java
@@ -18,10 +18,10 @@ import java.util.Properties;
import java.util.Set;
import org.apache.wiki.api.exceptions.WikiException;
-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 net.sf.ehcache.CacheManager;
@@ -34,7 +34,7 @@ public class ReferenceManagerTest
TestEngine engine;
ReferenceManager mgr;
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -53,7 +53,7 @@ public class ReferenceManagerTest
mgr = engine.getReferenceManager();
}
- @After
+ @AfterEach
public void tearDown()
throws Exception
{
@@ -72,8 +72,8 @@ public class ReferenceManagerTest
{
Collection< String > c = mgr.findReferrers("Foobar2");
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertTrue( c.size() == 1 && c.contains("Foobar") );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertTrue( c.size() == 1 && c.contains("Foobar") );
}
@Test
@@ -81,7 +81,7 @@ public class ReferenceManagerTest
{
Collection< String > c = mgr.findReferrers("TestBug");
- Assert.assertNull( c );
+ Assertions.assertNull( c );
}
@Test
@@ -90,21 +90,21 @@ public class ReferenceManagerTest
{
Collection< String > c = mgr.findReferrers("Foobar2");
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertTrue( c.size() == 1 && c.contains("Foobar") );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertTrue( c.size() == 1 && c.contains("Foobar") );
engine.deletePage( "Foobar" );
c = mgr.findReferrers("Foobar2");
- Assert.assertNull( c );
+ Assertions.assertNull( c );
engine.saveText( "Foobar", "[Foobar2]");
c = mgr.findReferrers("Foobar2");
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertTrue( c.size() == 1 && c.contains("Foobar") );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertTrue( c.size() == 1 && c.contains("Foobar") );
}
@Test
@@ -112,8 +112,7 @@ public class ReferenceManagerTest
throws Exception
{
Collection< String > c = mgr.findUnreferenced();
- Assert.assertTrue( "Unreferenced page not found by ReferenceManager",
- Util.collectionContains( c, "TestPage" ));
+ Assertions.assertTrue( Util.collectionContains( c, "TestPage" ), "Unreferenced page not found by ReferenceManager" );
}
@@ -124,15 +123,15 @@ public class ReferenceManagerTest
engine.saveText( "Foobar2", "[TestPage]" );
Collection< String > c = mgr.findUnreferenced();
- Assert.assertEquals( "Wrong # of orphan pages, stage 1", 0, c.size() );
+ Assertions.assertEquals( 0, c.size(), "Wrong # of orphan pages, stage 1" );
engine.saveText( "Foobar2", "norefs" );
c = mgr.findUnreferenced();
- Assert.assertEquals( "Wrong # of orphan pages", 1, c.size() );
+ Assertions.assertEquals( 1, c.size(), "Wrong # of orphan pages" );
Iterator i = c.iterator();
String first = (String) i.next();
- Assert.assertEquals( "Not correct referrers", "TestPage", first );
+ Assertions.assertEquals( "TestPage", first, "Not correct referrers" );
}
@Test
@@ -141,7 +140,7 @@ public class ReferenceManagerTest
{
Collection< String > c = mgr.findUncreated();
- Assert.assertTrue( c.size()==1 && ((String) c.iterator().next()).equals("Foobar2") );
+ Assertions.assertTrue( c.size()==1 && ((String) c.iterator().next()).equals("Foobar2") );
}
@Test
@@ -149,20 +148,20 @@ public class ReferenceManagerTest
throws Exception
{
Collection< String > c = mgr.findReferrers( "TestPage" );
- Assert.assertNull( "TestPage referrers", c );
+ Assertions.assertNull( c, "TestPage referrers" );
c = mgr.findReferrers( "Foobar" );
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertTrue( "Foobar referrers", c.size()==2 );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertTrue( c.size()==2, "Foobar referrers" );
c = mgr.findReferrers( "Foobar2" );
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertTrue( "Foobar2 referrers", c.size()==1 && ((String) c.iterator().next()).equals("Foobar") );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertTrue( c.size()==1 && ((String) c.iterator().next()).equals("Foobar"), "Foobar2 referrers" );
c = mgr.findReferrers( "Foobars" );
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertEquals( "Foobars referrers", 2, c.size() );
- //Assert.assertEquals( "Foobars referrer 'TestPage'", "TestPage", (String) c.iterator().next() );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertEquals( 2, c.size(), "Foobars referrers" );
+ //Assertions.assertEquals( "Foobars referrer 'TestPage'", "TestPage", (String) c.iterator().next() );
}
@Test
@@ -171,13 +170,13 @@ public class ReferenceManagerTest
{
Collection s = mgr.findRefersTo( "Foobar" );
- Assert.assertTrue( "does not have Foobar", s.contains("Foobar") );
- // Assert.assertTrue( "does not have Foobars", s.contains("Foobars") );
- Assert.assertTrue( "does not have Foobar2", s.contains("Foobar2") );
+ Assertions.assertTrue( s.contains("Foobar"), "does not have Foobar" );
+ // Assertions.assertTrue( "does not have Foobars", s.contains("Foobars") );
+ Assertions.assertTrue( s.contains("Foobar2"), "does not have Foobar2" );
}
/**
- * Should Assert.fail in 2.2.14-beta
+ * Should Assertions.fail in 2.2.14-beta
* @throws Exception
*/
@Test
@@ -190,8 +189,8 @@ public class ReferenceManagerTest
Collection< String > c = mgr.findReferrers( "FatalBugs" );
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertEquals( "FatalBugs referrers number", 2, c.size() );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertEquals( 2, c.size(), "FatalBugs referrers number" );
}
/**
@@ -207,14 +206,13 @@ public class ReferenceManagerTest
{
engine.saveText( "TestPage", "Reference to [Foobars]." );
Collection< String > c = mgr.findUnreferenced();
- Assert.assertTrue( "Foobar unreferenced", c.size()==1 && ((String) c.iterator().next()).equals("TestPage") );
+ Assertions.assertTrue( c.size()==1 && ((String) c.iterator().next()).equals("TestPage"), "Foobar unreferenced" );
c = mgr.findReferrers( "Foobar" );
- Assert.assertNotNull( "referrers expected", c );
+ Assertions.assertNotNull( c, "referrers expected" );
Iterator it = c.iterator();
String s1 = (String)it.next();
- Assert.assertTrue( "Foobar referrers",
- c.size()==2 );
+ Assertions.assertTrue( c.size()==2, "Foobar referrers" );
}
@@ -228,11 +226,11 @@ public class ReferenceManagerTest
throws Exception
{
engine.saveText( "Foobar2s", "qwertz" );
- Assert.assertTrue( "no uncreated", mgr.findUncreated().size()==0 );
+ Assertions.assertTrue( mgr.findUncreated().size()==0, "no uncreated" );
Collection< String > c = mgr.findReferrers( "Foobar2s" );
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertTrue( "referrers", c!=null && c.size()==1 && ((String) c.iterator().next()).equals("Foobar") );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertTrue( c!=null && c.size()==1 && ((String) c.iterator().next()).equals("Foobar"), "referrers" );
}
@Test
@@ -241,9 +239,9 @@ public class ReferenceManagerTest
{
engine.saveText( "Foobars", "qwertz" );
Collection< String > c = mgr.findReferrers( "Foobars" );
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertEquals( "Foobars referrers", 2, c.size() );
- Assert.assertTrue( "Foobars referrer is not TestPage", c.contains( "TestPage" ) && c.contains("Foobar"));
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertEquals( 2, c.size(), "Foobars referrers" );
+ Assertions.assertTrue( c.contains( "TestPage" ) && c.contains("Foobar"), "Foobars referrer is not TestPage" );
}
@Test
@@ -254,13 +252,13 @@ public class ReferenceManagerTest
engine.saveText( "TestPage", "Reference to [Foobar], [Foobars]." );
Collection< String > c = mgr.findReferrers( "Foobars" );
- Assert.assertNotNull( "referrers expected", c );
- Assert.assertEquals( "Foobars referrers count", 2, c.size() );
+ Assertions.assertNotNull( c, "referrers expected" );
+ Assertions.assertEquals( 2, c.size(), "Foobars referrers count" );
Iterator< String > i = c.iterator();
String first = i.next();
- Assert.assertTrue( "Foobars referrers", c.contains("TestPage") && c.contains("Foobar"));
+ Assertions.assertTrue( c.contains("TestPage") && c.contains("Foobar"), "Foobars referrers" );
}
@Test
@@ -269,8 +267,8 @@ public class ReferenceManagerTest
{
engine.saveText( "Foobar2", "ref to [TestPage]" );
- Assert.assertTrue( "no uncreated", mgr.findUncreated().size()==0 );
- Assert.assertTrue( "no unreferenced", mgr.findUnreferenced().size()==0 );
+ Assertions.assertTrue( mgr.findUncreated().size()==0, "no uncreated" );
+ Assertions.assertTrue( mgr.findUnreferenced().size()==0, "no unreferenced" );
}
@Test
@@ -284,20 +282,20 @@ public class ReferenceManagerTest
engine.saveText( "BugOne", "OpenBug" );
Collection< String > ref = mgr.findReferrers( "NewBugs" );
- Assert.assertNull("newbugs",ref); // No referrers must be found
+ Assertions.assertNull( ref, "newbugs" ); // No referrers must be found
ref = mgr.findReferrers( "NewBug" );
- Assert.assertNull("newbug",ref); // No referrers must be found
+ Assertions.assertNull( ref, "newbug" ); // No referrers must be found
ref = mgr.findReferrers( "OpenBugs" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("openbugs",1,ref.size());
- Assert.assertEquals("openbugs2","BugOne",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1, ref.size(), "openbugs" );
+ Assertions.assertEquals( ref.iterator().next(), "BugOne", "openbugs2" );
ref = mgr.findReferrers( "OpenBug" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("openbug",1,ref.size());
- Assert.assertEquals("openbug2","BugOne",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1, ref.size(), "openbug" );
+ Assertions.assertEquals( ref.iterator().next(), "BugOne", "openbugs2" );
}
@@ -312,20 +310,20 @@ public class ReferenceManagerTest
engine.saveText( "BugOne", "OpenBug" );
Collection< String > ref = mgr.findReferrers( "NewBugs" );
- Assert.assertNull("newbugs",ref); // No referrers must be found
+ Assertions.assertNull( ref, "newbugs" ); // No referrers must be found
ref = mgr.findReferrers( "NewBug" );
- Assert.assertNull("newbug",ref); // No referrers must be found
+ Assertions.assertNull( ref, "newbug" ); // No referrers must be found
ref = mgr.findReferrers( "OpenBugs" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("openbugs",1,ref.size());
- Assert.assertEquals("openbugs2","BugOne",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1, ref.size(), "openbugs" );
+ Assertions.assertEquals( "BugOne",ref.iterator().next(), "openbugs2" );
ref = mgr.findReferrers( "OpenBug" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("openbug",1,ref.size());
- Assert.assertEquals("openbug2","BugOne",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1, ref.size(), "openbug" );
+ Assertions.assertEquals( "BugOne",ref.iterator().next(), "openbug2" );
}
@@ -341,24 +339,24 @@ public class ReferenceManagerTest
engine.saveText( "BugOne", "OpenBug" );
Collection< String > ref = mgr.findReferrers( "NewBugs" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("newbugs",1,ref.size());
- Assert.assertEquals("newbugs2","BugTwo",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1,ref.size(), "newbugs" );
+ Assertions.assertEquals( "BugTwo",ref.iterator().next(), "newbugs2" );
ref = mgr.findReferrers( "NewBug" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("newbugs",1,ref.size());
- Assert.assertEquals("newbugs2","BugTwo",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1,ref.size(), "newbugs" );
+ Assertions.assertEquals( "BugTwo",ref.iterator().next(), "newbugs2" );
ref = mgr.findReferrers( "OpenBugs" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("openbugs",1,ref.size());
- Assert.assertEquals("openbugs2","BugOne",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1,ref.size(), "openbugs" );
+ Assertions.assertEquals( "BugOne",ref.iterator().next(), "openbugs2" );
ref = mgr.findReferrers( "OpenBug" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("openbug",1,ref.size());
- Assert.assertEquals("openbug2","BugOne",ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1,ref.size(), "openbug" );
+ Assertions.assertEquals( "BugOne",ref.iterator().next(), "openbug2" );
}
@@ -367,9 +365,9 @@ public class ReferenceManagerTest
{
engine.saveText( "BugOne", "BugOne" );
Collection< String > ref = mgr.findReferrers( "BugOne" );
- Assert.assertNotNull("referrers expected", ref);
- Assert.assertEquals("wrong size",1,ref.size());
- Assert.assertEquals("ref", "BugOne", ref.iterator().next());
+ Assertions.assertNotNull( ref, "referrers expected" );
+ Assertions.assertEquals( 1, ref.size(), "wrong size" );
+ Assertions.assertEquals( "BugOne", ref.iterator().next(), "ref");
}
/**
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/ReleaseTest.java b/jspwiki-war/src/test/java/org/apache/wiki/ReleaseTest.java
index 5196582..be9c452 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/ReleaseTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/ReleaseTest.java
@@ -18,33 +18,33 @@
*/
package org.apache.wiki;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
public class ReleaseTest
{
@Test
public void testNewer1()
{
- Assert.assertTrue( Release.isNewerOrEqual("1.0.100") );
+ Assertions.assertTrue( Release.isNewerOrEqual("1.0.100") );
}
@Test
public void testNewer2()
{
- Assert.assertTrue( Release.isNewerOrEqual("2.0.0-alpha") );
+ Assertions.assertTrue( Release.isNewerOrEqual("2.0.0-alpha") );
}
@Test
public void testNewer3()
{
- Assert.assertFalse( Release.isNewerOrEqual("10.0.0") );
+ Assertions.assertFalse( Release.isNewerOrEqual("10.0.0") );
}
@Test
public void testNewer4()
{
- Assert.assertTrue( Release.isNewerOrEqual(Release.VERSTR) );
+ Assertions.assertTrue( Release.isNewerOrEqual(Release.VERSTR) );
}
@Test
@@ -52,7 +52,7 @@ public class ReleaseTest
{
String rel = Release.VERSION+"."+Release.REVISION+"."+(Release.MINORREVISION+1)+"-cvs";
- Assert.assertFalse( Release.isNewerOrEqual(rel) );
+ Assertions.assertFalse( Release.isNewerOrEqual(rel) );
}
@Test
@@ -65,7 +65,7 @@ public class ReleaseTest
else
rel = Release.VERSION+"."+(Release.REVISION-1)+".9999"+"-cvs";
- Assert.assertTrue( Release.isNewerOrEqual(rel) );
+ Assertions.assertTrue( Release.isNewerOrEqual(rel) );
}
@Test
@@ -73,7 +73,7 @@ public class ReleaseTest
{
String rel = Release.VERSION+"."+Release.REVISION;
- Assert.assertTrue( Release.isNewerOrEqual(rel) );
+ Assertions.assertTrue( Release.isNewerOrEqual(rel) );
}
@Test
@@ -81,31 +81,31 @@ public class ReleaseTest
{
String rel = Release.VERSION+"";
- Assert.assertTrue( Release.isNewerOrEqual(rel) );
+ Assertions.assertTrue( Release.isNewerOrEqual(rel) );
}
@Test
public void testOlder1()
{
- Assert.assertFalse( Release.isOlderOrEqual("1.0.100") );
+ Assertions.assertFalse( Release.isOlderOrEqual("1.0.100") );
}
@Test
public void testOlder2()
{
- Assert.assertFalse( Release.isOlderOrEqual("2.0.0-alpha") );
+ Assertions.assertFalse( Release.isOlderOrEqual("2.0.0-alpha") );
}
@Test
public void testOlder3()
{
- Assert.assertTrue( Release.isOlderOrEqual("10.0.0") );
+ Assertions.assertTrue( Release.isOlderOrEqual("10.0.0") );
}
@Test
public void testOlder4()
{
- Assert.assertTrue( Release.isOlderOrEqual(Release.VERSTR) );
+ Assertions.assertTrue( Release.isOlderOrEqual(Release.VERSTR) );
}
@Test
@@ -113,7 +113,7 @@ public class ReleaseTest
{
String rel = Release.VERSION+"."+Release.REVISION+"."+(Release.MINORREVISION+1)+"-cvs";
- Assert.assertTrue( Release.isOlderOrEqual(rel) );
+ Assertions.assertTrue( Release.isOlderOrEqual(rel) );
}
@Test
@@ -126,7 +126,7 @@ public class ReleaseTest
else
rel = Release.VERSION+"."+(Release.REVISION-1)+".9999"+"-cvs";
- Assert.assertFalse( Release.isOlderOrEqual(rel) );
+ Assertions.assertFalse( Release.isOlderOrEqual(rel) );
}
@Test
@@ -134,7 +134,7 @@ public class ReleaseTest
{
String rel = Release.VERSION+"."+Release.REVISION;
- Assert.assertTrue( Release.isOlderOrEqual(rel) );
+ Assertions.assertTrue( Release.isOlderOrEqual(rel) );
}
@Test
@@ -142,7 +142,7 @@ public class ReleaseTest
{
String rel = Release.VERSION+"";
- Assert.assertTrue( Release.isOlderOrEqual(rel) );
+ Assertions.assertTrue( Release.isOlderOrEqual(rel) );
}
@Test
@@ -150,7 +150,7 @@ public class ReleaseTest
{
String rel = "";
- Assert.assertTrue( Release.isOlderOrEqual(rel) );
+ Assertions.assertTrue( Release.isOlderOrEqual(rel) );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
index 857fbff..1ab7bc2 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/VariableManagerTest.java
@@ -18,16 +18,16 @@
*/
package org.apache.wiki;
-import org.junit.Before;
-import org.junit.After;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
import java.util.Properties;
import org.apache.log4j.PropertyConfigurator;
import org.apache.wiki.api.exceptions.NoSuchVariableException;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
public class VariableManagerTest
{
@@ -36,7 +36,7 @@ public class VariableManagerTest
static final String PAGE_NAME = "TestPage";
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -49,7 +49,7 @@ public class VariableManagerTest
new WikiPage( testEngine, PAGE_NAME ) );
}
- @After
+ @AfterEach
public void tearDown()
{
}
@@ -61,7 +61,7 @@ public class VariableManagerTest
try
{
m_variableManager.parseAndGetValue( m_context, "" );
- Assert.fail( "Did not Assert.fail" );
+ Assertions.fail( "Did not Assertions.fail" );
}
catch( IllegalArgumentException e )
{
@@ -76,7 +76,7 @@ public class VariableManagerTest
try
{
m_variableManager.parseAndGetValue( m_context, "{$" );
- Assert.fail( "Did not Assert.fail" );
+ Assertions.fail( "Did not Assertions.fail" );
}
catch( IllegalArgumentException e )
{
@@ -91,7 +91,7 @@ public class VariableManagerTest
try
{
m_variableManager.parseAndGetValue( m_context, "{$pagename" );
- Assert.fail( "Did not Assert.fail" );
+ Assertions.fail( "Did not Assertions.fail" );
}
catch( IllegalArgumentException e )
{
@@ -106,7 +106,7 @@ public class VariableManagerTest
try
{
m_variableManager.parseAndGetValue( m_context, "{$}" );
- Assert.fail( "Did not Assert.fail" );
+ Assertions.fail( "Did not Assertions.fail" );
}
catch( IllegalArgumentException e )
{
@@ -120,7 +120,7 @@ public class VariableManagerTest
try
{
m_variableManager.parseAndGetValue( m_context, "{$no_such_variable}" );
- Assert.fail( "Did not Assert.fail" );
+ Assertions.fail( "Did not Assertions.fail" );
}
catch( NoSuchVariableException e )
{
@@ -134,7 +134,7 @@ public class VariableManagerTest
{
String res = m_variableManager.getValue( m_context, "pagename" );
- Assert.assertEquals( PAGE_NAME, res );
+ Assertions.assertEquals( PAGE_NAME, res );
}
@Test
@@ -143,7 +143,7 @@ public class VariableManagerTest
{
String res = m_variableManager.parseAndGetValue( m_context, "{$ pagename }" );
- Assert.assertEquals( PAGE_NAME, res );
+ Assertions.assertEquals( PAGE_NAME, res );
}
@Test
@@ -152,7 +152,7 @@ public class VariableManagerTest
{
String res = m_variableManager.parseAndGetValue( m_context, "{$PAGeNamE}" );
- Assert.assertEquals( PAGE_NAME, res );
+ Assertions.assertEquals( PAGE_NAME, res );
}
@Test
@@ -161,7 +161,7 @@ public class VariableManagerTest
{
String res = m_variableManager.expandVariables( m_context, "Testing {$pagename}..." );
- Assert.assertEquals( "Testing "+PAGE_NAME+"...", res );
+ Assertions.assertEquals( "Testing "+PAGE_NAME+"...", res );
}
@Test
@@ -170,7 +170,7 @@ public class VariableManagerTest
{
String res = m_variableManager.expandVariables( m_context, "{$pagename} tested..." );
- Assert.assertEquals( PAGE_NAME+" tested...", res );
+ Assertions.assertEquals( PAGE_NAME+" tested...", res );
}
@Test
@@ -179,7 +179,7 @@ public class VariableManagerTest
{
String res = m_variableManager.expandVariables( m_context, "Testing {$pagename}, {$applicationname}" );
- Assert.assertEquals( "Testing "+PAGE_NAME+", JSPWiki", res );
+ Assertions.assertEquals( "Testing "+PAGE_NAME+", JSPWiki", res );
}
@Test
@@ -188,7 +188,7 @@ public class VariableManagerTest
{
String res = m_variableManager.expandVariables( m_context, "Testing {}, {{{}" );
- Assert.assertEquals( "Testing {}, {{{}", res );
+ Assertions.assertEquals( "Testing {}, {{{}", res );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/WikiAjaxServletTest.java b/jspwiki-war/src/test/java/org/apache/wiki/WikiAjaxServletTest.java
index c5bf11e..55b5f65 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/WikiAjaxServletTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/WikiAjaxServletTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.wiki;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.apache.wiki.ajax.WikiAjaxDispatcherServlet;
import org.apache.wiki.ajax.WikiAjaxServlet;
@@ -44,28 +44,28 @@ public class WikiAjaxServletTest {
"/test//ajax/MyPlugin#hashCode?param=123¶m=231",
"http://localhost:8080/ajax/MyPlugin#hashCode?param=123¶m=231" };
- Assert.assertEquals(9,paths.length);
+ Assertions.assertEquals(9,paths.length);
WikiAjaxDispatcherServlet wikiAjaxDispatcherServlet = new WikiAjaxDispatcherServlet();
for (String path : paths) {
String servletName = wikiAjaxDispatcherServlet.getServletName(path);
- Assert.assertEquals("MyPlugin", servletName);
+ Assertions.assertEquals("MyPlugin", servletName);
}
// The plugin SampleAjaxPlugin
WikiAjaxDispatcherServlet.registerServlet(new SampleAjaxPlugin());
WikiAjaxServlet servlet = wikiAjaxDispatcherServlet.findServletByName("SampleAjaxPlugin");
- Assert.assertNotNull(servlet);
- Assert.assertTrue(servlet instanceof SampleAjaxPlugin);
+ Assertions.assertNotNull(servlet);
+ Assertions.assertTrue(servlet instanceof SampleAjaxPlugin);
/** Note sure about this
WikiAjaxDispatcherServlet.registerServlet(new RPCServlet());
WikiAjaxServlet servlet2 = wikiAjaxDispatcherServlet.findServletByName("RPCServlet");
- Assert.assertNotNull(servlet2);
- Assert.assertTrue(servlet2 instanceof RPCServlet);
+ Assertions.assertNotNull(servlet2);
+ Assertions.assertTrue(servlet2 instanceof RPCServlet);
*/
WikiAjaxServlet servlet3 = wikiAjaxDispatcherServlet.findServletByName("TestWikiNonAjaxServlet");
- Assert.assertNull(servlet3);
+ Assertions.assertNull(servlet3);
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/WikiEngineTest.java b/jspwiki-war/src/test/java/org/apache/wiki/WikiEngineTest.java
index 1a00b5a..906caa7 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/WikiEngineTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/WikiEngineTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.wiki;
-import org.junit.Before;
-import org.junit.After;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
import java.io.File;
import java.util.Collection;
@@ -34,8 +34,8 @@ import org.apache.wiki.providers.FileSystemProvider;
import org.apache.wiki.providers.VerySimpleProvider;
import org.apache.wiki.util.TextUtil;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
import net.sf.ehcache.CacheManager;
public class WikiEngineTest
@@ -48,12 +48,7 @@ public class WikiEngineTest
TestEngine m_engine;
- public static void main(String[] args)
- {
- junit.textui.TestRunner.main(new String[] { WikiEngineTest.class.getName() } );
- }
-
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -65,7 +60,7 @@ public class WikiEngineTest
m_engine = new TestEngine(props);
}
- @After
+ @AfterEach
public void tearDown()
{
String files = props.getProperty( FileSystemProvider.PROP_PAGEDIR );
@@ -92,8 +87,8 @@ public class WikiEngineTest
new TestEngine( props );
File f = new File( props.getProperty( FileSystemProvider.PROP_PAGEDIR ) );
- Assert.assertTrue( "didn't create it", f.exists() );
- Assert.assertTrue( "isn't a dir", f.isDirectory() );
+ Assertions.assertTrue( f.exists(), "didn't create it" );
+ Assertions.assertTrue( f.isDirectory(), "isn't a dir" );
f.delete();
}
@@ -107,9 +102,7 @@ public class WikiEngineTest
{
String pagename = "Test1";
- Assert.assertEquals( "Page already exists",
- false,
- m_engine.pageExists( pagename ) );
+ Assertions.assertEquals( false, m_engine.pageExists( pagename ), "Page already exists" );
}
/**
@@ -121,9 +114,7 @@ public class WikiEngineTest
{
WikiPage page = new WikiPage(m_engine, "Test1");
- Assert.assertEquals( "Page already exists",
- false,
- m_engine.pageExists( page ) );
+ Assertions.assertEquals( false, m_engine.pageExists( page ), "Page already exists" );
}
@Test
@@ -133,11 +124,8 @@ public class WikiEngineTest
m_engine.saveText( "Foobar", "1" );
m_engine.saveText( "Foobars", "2" );
- Assert.assertEquals( "plural mistake", "Foobars",
- m_engine.getFinalPageName( "Foobars" ) );
-
- Assert.assertEquals( "singular mistake", "Foobar",
- m_engine.getFinalPageName( "Foobar" ) );
+ Assertions.assertEquals( "Foobars",m_engine.getFinalPageName( "Foobars" ), "plural mistake" );
+ Assertions.assertEquals( "Foobar", m_engine.getFinalPageName( "Foobar" ), "singular mistake" );
}
@Test
@@ -146,10 +134,8 @@ public class WikiEngineTest
{
m_engine.saveText( "Foobar", "1" );
- Assert.assertEquals( "plural mistake", "Foobar",
- m_engine.getFinalPageName( "Foobars" ) );
- Assert.assertEquals( "singular mistake", "Foobar",
- m_engine.getFinalPageName( "Foobar" ) );
+ Assertions.assertEquals( "Foobar", m_engine.getFinalPageName( "Foobars" ), "plural mistake" );
+ Assertions.assertEquals( "Foobar", m_engine.getFinalPageName( "Foobar" ), "singular mistake" );
}
@Test
@@ -158,10 +144,8 @@ public class WikiEngineTest
{
m_engine.saveText( "Foobars", "1" );
- Assert.assertEquals( "plural mistake", "Foobars",
- m_engine.getFinalPageName( "Foobars" ) );
- Assert.assertEquals( "singular mistake", "Foobars",
- m_engine.getFinalPageName( "Foobar" ) );
+ Assertions.assertEquals( "Foobars", m_engine.getFinalPageName( "Foobars" ), "plural mistake" );
+ Assertions.assertEquals( "Foobars", m_engine.getFinalPageName( "Foobar" ), "singular mistake" );
}
@Test
@@ -173,13 +157,8 @@ public class WikiEngineTest
m_engine.saveText( name, text );
- Assert.assertEquals( "page does not exist",
- true,
- m_engine.pageExists( name ) );
-
- Assert.assertEquals( "wrong content",
- text,
- m_engine.getText( name ) );
+ Assertions.assertEquals( true, m_engine.pageExists( name ), "page does not exist" );
+ Assertions.assertEquals( text, m_engine.getText( name ), "wrong content" );
}
@Test
@@ -191,13 +170,8 @@ public class WikiEngineTest
m_engine.saveText( name, text );
- Assert.assertEquals( "page does not exist",
- true,
- m_engine.pageExists( name ) );
-
- Assert.assertEquals( "wrong content",
- "Foobar. &quot;\r\n",
- m_engine.getText( name ) );
+ Assertions.assertEquals( true, m_engine.pageExists( name ), "page does not exist" );
+ Assertions.assertEquals( "Foobar. &quot;\r\n", m_engine.getText( name ), "wrong content" );
}
/**
@@ -212,13 +186,8 @@ public class WikiEngineTest
m_engine.saveText( name, text );
- Assert.assertEquals( "page does not exist",
- true,
- m_engine.pageExists( name ) );
-
- Assert.assertEquals( "wrong content",
- "Foobar. "\r\n",
- m_engine.getText( name ) );
+ Assertions.assertEquals( true, m_engine.pageExists( name ), "page does not exist" );
+ Assertions.assertEquals( "Foobar. "\r\n", m_engine.getText( name ), "wrong content" );
}
@Test
@@ -232,8 +201,7 @@ public class WikiEngineTest
String data = m_engine.getHTML( name );
- Assert.assertEquals( "<i>Foobar.</i>\n",
- data );
+ Assertions.assertEquals( "<i>Foobar.</i>\n", data );
}
@Test
@@ -241,8 +209,7 @@ public class WikiEngineTest
{
String name = "abc\u00e5\u00e4\u00f6";
- Assert.assertEquals( "abc%E5%E4%F6",
- m_engine.encodeName(name) );
+ Assertions.assertEquals( "abc%E5%E4%F6", m_engine.encodeName(name) );
}
@Test
@@ -255,8 +222,7 @@ public class WikiEngineTest
WikiEngine engine = new TestEngine( props );
- Assert.assertEquals( "A%E2%89%A2%CE%91.",
- engine.encodeName(name) );
+ Assertions.assertEquals( "A%E2%89%A2%CE%91.", engine.encodeName(name) );
}
@Test
@@ -267,8 +233,8 @@ public class WikiEngineTest
Object[] result = m_engine.scanWikiLinks( new WikiPage(m_engine, "Test"), src ).toArray();
- Assert.assertEquals( "item 0", "Foobar", result[0] );
- Assert.assertEquals( "item 1", "This is a link", result[1] );
+ Assertions.assertEquals( "Foobar", result[0], "item 0" );
+ Assertions.assertEquals( "This is a link", result[1], "item 1" );
}
@Test
@@ -276,7 +242,7 @@ public class WikiEngineTest
{
String src = "WikiNameThingy";
- Assert.assertEquals("Wiki Name Thingy", m_engine.beautifyTitle( src ) );
+ Assertions.assertEquals("Wiki Name Thingy", m_engine.beautifyTitle( src ) );
}
/**
@@ -287,7 +253,7 @@ public class WikiEngineTest
{
String src = "JSPWikiPage";
- Assert.assertEquals("JSP Wiki Page", m_engine.beautifyTitle( src ) );
+ Assertions.assertEquals("JSP Wiki Page", m_engine.beautifyTitle( src ) );
}
/**
@@ -298,7 +264,7 @@ public class WikiEngineTest
{
String src = "DELETEME";
- Assert.assertEquals("DELETEME", m_engine.beautifyTitle( src ) );
+ Assertions.assertEquals("DELETEME", m_engine.beautifyTitle( src ) );
}
@Test
@@ -306,7 +272,7 @@ public class WikiEngineTest
{
String src = "JSPWikiFAQ";
- Assert.assertEquals("JSP Wiki FAQ", m_engine.beautifyTitle( src ) );
+ Assertions.assertEquals("JSP Wiki FAQ", m_engine.beautifyTitle( src ) );
}
@Test
@@ -314,7 +280,7 @@ public class WikiEngineTest
{
String src = "TestPage12";
- Assert.assertEquals("Test Page 12", m_engine.beautifyTitle( src ) );
+ Assertions.assertEquals("Test Page 12", m_engine.beautifyTitle( src ) );
}
/**
@@ -325,7 +291,7 @@ public class WikiEngineTest
{
String src = "ThisIsAPage";
- Assert.assertEquals("This Is A Page", m_engine.beautifyTitle( src ) );
+ Assertions.assertEquals("This Is A Page", m_engine.beautifyTitle( src ) );
}
/**
@@ -337,7 +303,7 @@ public class WikiEngineTest
{
String src = "ThisIsAJSPWikiPage";
- Assert.assertEquals("This Is A JSP Wiki Page", m_engine.beautifyTitle( src ) );
+ Assertions.assertEquals("This Is A JSP Wiki Page", m_engine.beautifyTitle( src ) );
}
*/
@@ -355,9 +321,9 @@ public class WikiEngineTest
VerySimpleProvider vsp = (VerySimpleProvider) engine.getPageManager().getProvider();
- Assert.assertEquals( "wrong page", "test", vsp.m_latestReq );
- Assert.assertEquals( "wrong version", -1, vsp.m_latestVers );
- Assert.assertNotNull("null", p);
+ Assertions.assertEquals( "test", vsp.m_latestReq, "wrong page" );
+ Assertions.assertEquals( -1, vsp.m_latestVers, "wrong version" );
+ Assertions.assertNotNull( p, "null" );
}
@Test
@@ -374,9 +340,9 @@ public class WikiEngineTest
VerySimpleProvider vsp = (VerySimpleProvider) engine.getPageManager().getProvider();
- Assert.assertEquals( "wrong page", "test", vsp.m_latestReq );
- Assert.assertEquals( "wrong version", -1, vsp.m_latestVers );
- Assert.assertNotNull("null", p);
+ Assertions.assertEquals( "test", vsp.m_latestReq, "wrong page" );
+ Assertions.assertEquals( -1, vsp.m_latestVers, "wrong version" );
+ Assertions.assertNotNull( p, "null" );
}
@Test
@@ -393,9 +359,9 @@ public class WikiEngineTest
VerySimpleProvider vsp = (VerySimpleProvider) engine.getPageManager().getProvider();
- Assert.assertEquals( "wrong page", "test", vsp.m_latestReq );
- Assert.assertEquals( "wrong version", 5, vsp.m_latestVers );
- Assert.assertNotNull("null", p);
+ Assertions.assertEquals( "test", vsp.m_latestReq, "wrong page" );
+ Assertions.assertEquals( 5, vsp.m_latestVers, "wrong version" );
+ Assertions.assertNotNull( p, "null" );
}
@Test
@@ -413,9 +379,9 @@ public class WikiEngineTest
CachingProvider cp = (CachingProvider)engine.getPageManager().getProvider();
VerySimpleProvider vsp = (VerySimpleProvider) cp.getRealProvider();
- Assert.assertEquals( "wrong page", VerySimpleProvider.PAGENAME, vsp.m_latestReq );
- Assert.assertEquals( "wrong version", -1, vsp.m_latestVers );
- Assert.assertNotNull("null", p);
+ Assertions.assertEquals( VerySimpleProvider.PAGENAME, vsp.m_latestReq, "wrong page" );
+ Assertions.assertEquals( -1, vsp.m_latestVers, "wrong version" );
+ Assertions.assertNotNull( p, "null" );
}
/**
@@ -438,17 +404,15 @@ public class WikiEngineTest
{
// and check post-conditions
Collection c = refMgr.findUncreated();
- Assert.assertTrue("attachment exists: "+c,
- c==null || c.size()==0 );
+ Assertions.assertTrue( c==null || c.size()==0, "attachment exists: "+c );
c = refMgr.findUnreferenced();
- Assert.assertEquals( "unreferenced count", 2, c.size() );
+ Assertions.assertEquals( 2, c.size(), "unreferenced count" );
Iterator< String > i = c.iterator();
String first = i.next();
String second = i.next();
- Assert.assertTrue( "unreferenced",
- (first.equals( NAME1 ) && second.equals( NAME1+"/TestAtt.txt"))
- || (first.equals( NAME1+"/TestAtt.txt" ) && second.equals( NAME1 )) );
+ Assertions.assertTrue( (first.equals( NAME1 ) && second.equals( NAME1+"/TestAtt.txt"))
+ || (first.equals( NAME1+"/TestAtt.txt" ) && second.equals( NAME1 )), "unreferenced" );
}
finally
{
@@ -490,17 +454,13 @@ public class WikiEngineTest
// check a few pre-conditions
Collection c = refMgr.findReferrers( "TestAtt.txt" );
- Assert.assertTrue( "normal, unexisting page",
- c!=null && ((String)c.iterator().next()).equals( NAME1 ) );
+ Assertions.assertTrue( c!=null && ((String)c.iterator().next()).equals( NAME1 ), "normal, unexisting page" );
c = refMgr.findReferrers( NAME1+"/TestAtt.txt" );
- Assert.assertTrue( "no attachment", c==null || c.size()==0 );
+ Assertions.assertTrue( c==null || c.size()==0, "no attachment" );
c = refMgr.findUncreated();
- Assert.assertTrue( "unknown attachment",
- c!=null &&
- c.size()==1 &&
- ((String)c.iterator().next()).equals( "TestAtt.txt" ) );
+ Assertions.assertTrue( c!=null && c.size()==1 && ((String)c.iterator().next()).equals( "TestAtt.txt" ), "unknown attachment" );
// now we create the attachment
@@ -511,18 +471,16 @@ public class WikiEngineTest
{
// and check post-conditions
c = refMgr.findUncreated();
- Assert.assertTrue( "attachment exists: ",
- c==null || c.size()==0 );
+ Assertions.assertTrue( c==null || c.size()==0, "attachment exists: " );
c = refMgr.findReferrers( "TestAtt.txt" );
- Assert.assertTrue( "no normal page", c==null || c.size()==0 );
+ Assertions.assertTrue( c==null || c.size()==0, "no normal page" );
c = refMgr.findReferrers( NAME1+"/TestAtt.txt" );
- Assert.assertTrue( "attachment exists now", c!=null && ((String)c.iterator().next()).equals( NAME1 ) );
+ Assertions.assertTrue( c!=null && ((String)c.iterator().next()).equals( NAME1 ), "attachment exists now" );
c = refMgr.findUnreferenced();
- Assert.assertTrue( "unreferenced",
- c.size()==1 && ((String)c.iterator().next()).equals( NAME1 ));
+ Assertions.assertTrue( c.size()==1 && ((String)c.iterator().next()).equals( NAME1 ), "unreferenced" );
}
finally
{
@@ -554,13 +512,11 @@ public class WikiEngineTest
{
// and check post-conditions
Collection c = refMgr.findUncreated();
- Assert.assertTrue( "attachment exists",
- c==null || c.size()==0 );
+ Assertions.assertTrue( c==null || c.size()==0, "attachment exists" );
c = refMgr.findUnreferenced();
- Assert.assertEquals( "unreferenced count", c.size(), 1 );
- Assert.assertTrue( "unreferenced",
- ((String)c.iterator().next()).equals( NAME1 ) );
+ Assertions.assertEquals( c.size(), 1, "unreferenced count" );
+ Assertions.assertTrue( ((String)c.iterator().next()).equals( NAME1 ), "unreferenced" );
}
finally
{
@@ -592,13 +548,11 @@ public class WikiEngineTest
{
// and check post-conditions
Collection c = refMgr.findUncreated();
- Assert.assertTrue( "attachment exists",
- c==null || c.size()==0 );
+ Assertions.assertTrue( c==null || c.size()==0, "attachment exists" );
c = refMgr.findUnreferenced();
- Assert.assertEquals( "unreferenced count", c.size(), 1 );
- Assert.assertTrue( "unreferenced",
- ((String)c.iterator().next()).equals( NAME1 ) );
+ Assertions.assertEquals( c.size(), 1, "unreferenced count" );
+ Assertions.assertTrue( ((String)c.iterator().next()).equals( NAME1 ), "unreferenced" );
}
finally
{
@@ -621,13 +575,13 @@ public class WikiEngineTest
String files = props.getProperty( FileSystemProvider.PROP_PAGEDIR );
File saved = new File( files, NAME1+FileSystemProvider.FILE_EXT );
- Assert.assertTrue( "Didn't create it!", saved.exists() );
+ Assertions.assertTrue( saved.exists(), "Didn't create it!" );
WikiPage page = m_engine.getPage( NAME1, WikiProvider.LATEST_VERSION );
m_engine.deletePage( page.getName() );
- Assert.assertFalse( "Page has not been removed!", saved.exists() );
+ Assertions.assertFalse( saved.exists(), "Page has not been removed!" );
}
@@ -647,16 +601,16 @@ public class WikiEngineTest
String atts = props.getProperty( BasicAttachmentProvider.PROP_STORAGEDIR );
File attfile = new File( atts, NAME1+"-att/TestAtt.txt-dir" );
- Assert.assertTrue( "Didn't create it!", saved.exists() );
+ Assertions.assertTrue( saved.exists(), "Didn't create it!" );
- Assert.assertTrue( "Attachment dir does not exist", attfile.exists() );
+ Assertions.assertTrue( attfile.exists(), "Attachment dir does not exist" );
WikiPage page = m_engine.getPage( NAME1, WikiProvider.LATEST_VERSION );
m_engine.deletePage( page.getName() );
- Assert.assertFalse( "Page has not been removed!", saved.exists() );
- Assert.assertFalse( "Attachment has not been removed", attfile.exists() );
+ Assertions.assertFalse( saved.exists(), "Page has not been removed!" );
+ Assertions.assertFalse( attfile.exists(), "Attachment has not been removed" );
}
@Test
@@ -675,13 +629,13 @@ public class WikiEngineTest
String atts = props.getProperty( BasicAttachmentProvider.PROP_STORAGEDIR );
File attfile = new File( atts, NAME1+"-att/TestAtt.txt-dir" );
- Assert.assertTrue( "Didn't create it!", saved.exists() );
+ Assertions.assertTrue( saved.exists(), "Didn't create it!" );
- Assert.assertTrue( "Attachment dir does not exist", attfile.exists() );
+ Assertions.assertTrue( attfile.exists(), "Attachment dir does not exist" );
WikiPage page = m_engine.getPage( NAME1, WikiProvider.LATEST_VERSION );
- Assert.assertNotNull( "page", page );
+ Assertions.assertNotNull( page, "page" );
att = m_engine.getAttachmentManager().getAttachmentInfo(NAME1+"/TestAtt.txt");
@@ -689,12 +643,12 @@ public class WikiEngineTest
m_engine.deletePage( NAME1 );
- Assert.assertNull( "Page not removed", m_engine.getPage(NAME1) );
- Assert.assertNull( "Att not removed", m_engine.getPage(NAME1+"/TestAtt.txt") );
+ Assertions.assertNull( m_engine.getPage(NAME1), "Page not removed" );
+ Assertions.assertNull( m_engine.getPage(NAME1+"/TestAtt.txt"), "Att not removed" );
Collection refs = m_engine.getReferenceManager().findReferrers(NAME1);
- Assert.assertNull( "referrers", refs );
+ Assertions.assertNull( refs, "referrers" );
}
@Test
@@ -712,11 +666,11 @@ public class WikiEngineTest
engine.deleteVersion( page );
- Assert.assertNull( "got page", engine.getPage( NAME1, 3 ) );
+ Assertions.assertNull( engine.getPage( NAME1, 3 ), "got page" );
String content = engine.getText( NAME1, WikiProvider.LATEST_VERSION );
- Assert.assertEquals( "content", "Test2", content.trim() );
+ Assertions.assertEquals( "Test2", content.trim(), "content" );
}
@Test
@@ -734,13 +688,13 @@ public class WikiEngineTest
engine.deleteVersion( page );
- Assert.assertNull( "got page", engine.getPage( NAME1, 1 ) );
+ Assertions.assertNull( engine.getPage( NAME1, 1 ), "got page" );
String content = engine.getText( NAME1, WikiProvider.LATEST_VERSION );
- Assert.assertEquals( "content", "Test3", content.trim() );
+ Assertions.assertEquals( "Test3", content.trim(), "content" );
- Assert.assertEquals( "content1", "", engine.getText(NAME1, 1).trim() );
+ Assertions.assertEquals( "", engine.getText(NAME1, 1).trim(), "content1" );
}
@@ -766,10 +720,10 @@ public class WikiEngineTest
WikiPage v2 = engine.getPage( NAME1, 2 );
- Assert.assertEquals( "V1", "bar", v1.getAttribute("foo") );
+ Assertions.assertEquals( "bar", v1.getAttribute("foo"), "V1" );
// FIXME: The following must run as well
- Assert.assertEquals( "V2", "notbar", v2.getAttribute("foo") );
+ Assertions.assertEquals( "notbar", v2.getAttribute("foo"), "V2" );
engine.deletePage( NAME1 );
}
@@ -780,7 +734,7 @@ public class WikiEngineTest
{
m_engine.saveText("This is a test", "puppaa");
- Assert.assertEquals( "normal", "puppaa", m_engine.getText("This is a test").trim() );
+ Assertions.assertEquals( "puppaa", m_engine.getText("This is a test").trim(), "normal" );
}
@@ -791,7 +745,7 @@ public class WikiEngineTest
String res = m_engine.getHTML( "TestPage" );
- Assert.assertEquals( "bar\n", res );
+ Assertions.assertEquals( "bar\n", res );
}
/**
@@ -806,20 +760,20 @@ public class WikiEngineTest
m_engine.saveText( "OldNameTestPage", "Linked to RenameBugTestPage" );
Collection pages = m_engine.getReferenceManager().findReferrers( "RenameBugTestPage" );
- Assert.assertEquals( "has one", "OldNameTestPage", pages.iterator().next() );
+ Assertions.assertEquals( "OldNameTestPage", pages.iterator().next(), "has one" );
WikiContext ctx = new WikiContext( m_engine, m_engine.getPage("OldNameTestPage") );
m_engine.renamePage( ctx, "OldNameTestPage", "NewNameTestPage", true );
- Assert.assertFalse( "did not vanish", m_engine.pageExists( "OldNameTestPage") );
- Assert.assertTrue( "did not appear", m_engine.pageExists( "NewNameTestPage") );
+ Assertions.assertFalse( m_engine.pageExists( "OldNameTestPage"), "did not vanish" );
+ Assertions.assertTrue( m_engine.pageExists( "NewNameTestPage"), "did not appear" );
pages = m_engine.getReferenceManager().findReferrers( "RenameBugTestPage" );
- Assert.assertEquals( "wrong # of referrers", 1, pages.size() );
+ Assertions.assertEquals( 1, pages.size(), "wrong # of referrers" );
- Assert.assertEquals( "has wrong referrer", "NewNameTestPage", pages.iterator().next() );
+ Assertions.assertEquals( "NewNameTestPage", pages.iterator().next(), "has wrong referrer" );
}
@Test
@@ -845,7 +799,7 @@ public class WikiEngineTest
WikiPage p3 = m_engine.getPage( NAME1, -1 );
- Assert.assertEquals( null, p3.getAttribute(WikiPage.CHANGENOTE) );
+ Assertions.assertEquals( null, p3.getAttribute(WikiPage.CHANGENOTE) );
}
@Test
@@ -854,15 +808,11 @@ public class WikiEngineTest
String text = "Foobar.\r\n";
String name = "mrmyxpltz";
- Assert.assertEquals( "page should not exist right now",
- false,
- m_engine.pageExists( name ) );
+ Assertions.assertEquals( false, m_engine.pageExists( name ), "page should not exist right now" );
m_engine.saveText( name, text );
- Assert.assertEquals( "page does not exist",
- true,
- m_engine.pageExists( name ) );
+ Assertions.assertEquals( true, m_engine.pageExists( name ), "page does not exist" );
}
@Test
@@ -871,15 +821,11 @@ public class WikiEngineTest
String text = "";
String name = "mrmxyzptlk";
- Assert.assertEquals( "page should not exist right now",
- false,
- m_engine.pageExists( name ) );
+ Assertions.assertEquals( false, m_engine.pageExists( name ), "page should not exist right now" );
m_engine.saveText( name, text );
- Assert.assertEquals( "page should not exist right now neither",
- false,
- m_engine.pageExists( name ) );
+ Assertions.assertEquals( false, m_engine.pageExists( name ), "page should not exist right now neither" );
}
@Test
@@ -890,21 +836,14 @@ public class WikiEngineTest
m_engine.saveText( name, text );
- Assert.assertEquals( "page does not exist",
- true,
- m_engine.pageExists( name ) );
+ Assertions.assertEquals( true, m_engine.pageExists( name ), "page does not exist" );
// saveText uses normalizePostData to assure it conforms to certain rules
- Assert.assertEquals( "wrong content",
- TextUtil.normalizePostData( text ),
- m_engine.getText( name ) );
+ Assertions.assertEquals( TextUtil.normalizePostData( text ), m_engine.getText( name ), "wrong content" );
m_engine.saveText( name, "" );
- Assert.assertEquals( "wrong content",
- TextUtil.normalizePostData( "" ),
- m_engine.getText( name ) );
-
+ Assertions.assertEquals( TextUtil.normalizePostData( "" ), m_engine.getText( name ), "wrong content" );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/WikiSessionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/WikiSessionTest.java
index 21efed3..d359733 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/WikiSessionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/WikiSessionTest.java
@@ -42,9 +42,9 @@ import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.login.CookieAssertionLoginModule;
import org.apache.wiki.auth.login.CookieAuthenticationLoginModule;
import org.apache.wiki.ui.WikiServletFilter;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import net.sourceforge.stripes.mock.MockFilterChain;
import net.sourceforge.stripes.mock.MockFilterConfig;
@@ -57,7 +57,7 @@ public class WikiSessionTest
private TestEngine m_engine = null;
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -73,58 +73,58 @@ public class WikiSessionTest
// Test roles for guest session
session = WikiSession.guestSession( m_engine );
principals = session.getRoles();
- Assert.assertTrue( session.isAnonymous() );
- Assert.assertFalse( session.isAuthenticated() );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
+ Assertions.assertTrue( session.isAnonymous() );
+ Assertions.assertFalse( session.isAuthenticated() );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
// Test roles for anonymous session
session = anonymousSession( m_engine );
principals = session.getRoles();
- Assert.assertTrue( session.isAnonymous() );
- Assert.assertFalse( session.isAuthenticated() );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
+ Assertions.assertTrue( session.isAnonymous() );
+ Assertions.assertFalse( session.isAuthenticated() );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
// Test roles for authenticated session
session = authenticatedSession( m_engine,
Users.JANNE,
Users.JANNE_PASS );
principals = session.getRoles();
- Assert.assertFalse( session.isAnonymous() );
- Assert.assertTrue( session.isAuthenticated() );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
+ Assertions.assertFalse( session.isAnonymous() );
+ Assertions.assertTrue( session.isAuthenticated() );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
// Test roles for admin session
session = adminSession( m_engine );
principals = session.getRoles();
- Assert.assertFalse( session.isAnonymous() );
- Assert.assertTrue( session.isAuthenticated() );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
- Assert.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
- Assert.assertTrue( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
+ Assertions.assertFalse( session.isAnonymous() );
+ Assertions.assertTrue( session.isAuthenticated() );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ALL ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ANONYMOUS ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.AUTHENTICATED ) );
}
@Test
public void testIsIPAddress()
{
- Assert.assertFalse( WikiSession.isIPV4Address( "Me" ) );
- Assert.assertFalse( WikiSession.isIPV4Address( "Guest" ) );
- Assert.assertTrue( WikiSession.isIPV4Address( "127.0.0.1" ) );
- Assert.assertFalse( WikiSession.isIPV4Address( "1207.0.0.1" ) );
- Assert.assertFalse( WikiSession.isIPV4Address( "127..0.1" ) );
- Assert.assertFalse( WikiSession.isIPV4Address( "1207.0.0." ) );
- Assert.assertFalse( WikiSession.isIPV4Address( ".0.0.1" ) );
- Assert.assertFalse( WikiSession.isIPV4Address( "..." ) );
+ Assertions.assertFalse( WikiSession.isIPV4Address( "Me" ) );
+ Assertions.assertFalse( WikiSession.isIPV4Address( "Guest" ) );
+ Assertions.assertTrue( WikiSession.isIPV4Address( "127.0.0.1" ) );
+ Assertions.assertFalse( WikiSession.isIPV4Address( "1207.0.0.1" ) );
+ Assertions.assertFalse( WikiSession.isIPV4Address( "127..0.1" ) );
+ Assertions.assertFalse( WikiSession.isIPV4Address( "1207.0.0." ) );
+ Assertions.assertFalse( WikiSession.isIPV4Address( ".0.0.1" ) );
+ Assertions.assertFalse( WikiSession.isIPV4Address( "..." ) );
}
@Test
@@ -138,7 +138,7 @@ public class WikiSessionTest
request.setUserPrincipal( null );
runSecurityFilter(m_engine, request);
wikiSession = WikiSession.getWikiSession( m_engine, request );
- Assert.assertTrue( wikiSession.isAnonymous());
+ Assertions.assertTrue( wikiSession.isAnonymous());
}
@Test
@@ -152,8 +152,8 @@ public class WikiSessionTest
request.setUserPrincipal( new WikiPrincipal( "Fred Flintstone") );
runSecurityFilter(m_engine, request);
wikiSession = WikiSession.getWikiSession( m_engine, request );
- Assert.assertTrue( wikiSession.isAuthenticated());
- Assert.assertEquals( "Fred Flintstone", wikiSession.getUserPrincipal().getName() );
+ Assertions.assertTrue( wikiSession.isAuthenticated());
+ Assertions.assertEquals( "Fred Flintstone", wikiSession.getUserPrincipal().getName() );
}
@Test
@@ -169,8 +169,8 @@ public class WikiSessionTest
request.setCookies( new Cookie[] { new Cookie( cookieName, "FredFlintstone" ) } );
runSecurityFilter(m_engine, request);
wikiSession = WikiSession.getWikiSession( m_engine, request );
- Assert.assertTrue( wikiSession.isAsserted());
- Assert.assertEquals( "FredFlintstone", wikiSession.getUserPrincipal().getName() );
+ Assertions.assertTrue( wikiSession.isAsserted());
+ Assertions.assertEquals( "FredFlintstone", wikiSession.getUserPrincipal().getName() );
}
@Test
@@ -183,7 +183,7 @@ public class WikiSessionTest
MockHttpServletResponse response = new MockHttpServletResponse();
CookieAuthenticationLoginModule.setLoginCookie( m_engine, response, "Fred Flintstone" );
Cookie[] cookies = response.getCookies();
- Assert.assertEquals(1, cookies.length);
+ Assertions.assertEquals(1, cookies.length);
String uid = cookies[0].getValue();
// Adding the magic "authentication cookie" should NOT count as authenticated in the default case
@@ -193,9 +193,9 @@ public class WikiSessionTest
request.setCookies( new Cookie[] { new Cookie( "JSPWikiUID", uid ) } );
runSecurityFilter(m_engine, request);
wikiSession = WikiSession.getWikiSession( m_engine, request );
- Assert.assertTrue( wikiSession.isAnonymous());
- Assert.assertFalse( wikiSession.isAuthenticated());
- Assert.assertEquals( "127.0.0.1", wikiSession.getUserPrincipal().getName() );
+ Assertions.assertTrue( wikiSession.isAnonymous());
+ Assertions.assertFalse( wikiSession.isAuthenticated());
+ Assertions.assertEquals( "127.0.0.1", wikiSession.getUserPrincipal().getName() );
// Clear the authentication cookie
response = new MockHttpServletResponse();
@@ -216,7 +216,7 @@ public class WikiSessionTest
MockHttpServletResponse response = new MockHttpServletResponse();
CookieAuthenticationLoginModule.setLoginCookie( m_engine, response, "Fred Flintstone" );
Cookie[] cookies = response.getCookies();
- Assert.assertEquals(1, cookies.length);
+ Assertions.assertEquals(1, cookies.length);
String uid = cookies[0].getValue();
// Adding the magic "authentication cookie" should count as authenticated
@@ -225,9 +225,9 @@ public class WikiSessionTest
request.setCookies( new Cookie[] { new Cookie( "JSPWikiUID", uid ) } );
runSecurityFilter(m_engine, request);
wikiSession = WikiSession.getWikiSession( m_engine, request );
- Assert.assertFalse( wikiSession.isAnonymous());
- Assert.assertTrue( wikiSession.isAuthenticated());
- Assert.assertEquals( "Fred Flintstone", wikiSession.getUserPrincipal().getName() );
+ Assertions.assertFalse( wikiSession.isAnonymous());
+ Assertions.assertTrue( wikiSession.isAuthenticated());
+ Assertions.assertEquals( "Fred Flintstone", wikiSession.getUserPrincipal().getName() );
// Clear the authentication cookie
response = new MockHttpServletResponse();
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/attachment/AttachmentManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/attachment/AttachmentManagerTest.java
index 8eb63e2..15f2504 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/attachment/AttachmentManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/attachment/AttachmentManagerTest.java
@@ -26,10 +26,10 @@ import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiPage;
import org.apache.wiki.api.exceptions.ProviderException;
import org.apache.wiki.util.FileUtil;
-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 net.sf.ehcache.CacheManager;
@@ -45,7 +45,7 @@ public class AttachmentManagerTest
static String c_fileContents = "ABCDEFGHIJKLMNOPQRSTUVWxyz";
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -75,7 +75,7 @@ public class AttachmentManagerTest
return tmpFile;
}
- @After
+ @AfterEach
public void tearDown()
{
m_engine.deleteTestPage( NAME1 );
@@ -90,7 +90,7 @@ public class AttachmentManagerTest
@Test
public void testEnabled()
{
- Assert.assertTrue( "not enabled", m_manager.attachmentsEnabled() );
+ Assertions.assertTrue( m_manager.attachmentsEnabled(), "not enabled" );
}
@Test
@@ -103,18 +103,16 @@ public class AttachmentManagerTest
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
- "test1.txt" );
+ Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine, new WikiPage(m_engine, NAME1)), "test1.txt" );
- Assert.assertNotNull( "attachment disappeared", att2 );
- Assert.assertEquals( "name", att.getName(), att2.getName() );
- Assert.assertEquals( "author", att.getAuthor(), att2.getAuthor() );
- Assert.assertEquals( "size", c_fileContents.length(), att2.getSize() );
+ Assertions.assertNotNull( att2, "attachment disappeared" );
+ Assertions.assertEquals( att.getName(), att2.getName(), "name" );
+ Assertions.assertEquals( att.getAuthor(), att2.getAuthor(), "author" );
+ Assertions.assertEquals( c_fileContents.length(), att2.getSize(), "size" );
InputStream in = m_manager.getAttachmentStream( att2 );
- Assert.assertNotNull( "stream", in );
+ Assertions.assertNotNull( in, "stream" );
StringWriter sout = new StringWriter();
FileUtil.copyContents( new InputStreamReader(in), sout );
@@ -122,7 +120,7 @@ public class AttachmentManagerTest
in.close();
sout.close();
- Assert.assertEquals( "contents", c_fileContents, sout.toString() );
+ Assertions.assertEquals( c_fileContents, sout.toString(), "contents" );
}
@Test
@@ -139,14 +137,14 @@ public class AttachmentManagerTest
new WikiPage(m_engine, NAME1)),
"test file.txt" );
- Assert.assertNotNull( "attachment disappeared", att2 );
- Assert.assertEquals( "name", att.getName(), att2.getName() );
- Assert.assertEquals( "author", att.getAuthor(), att2.getAuthor() );
- Assert.assertEquals( "size", c_fileContents.length(), att2.getSize() );
+ Assertions.assertNotNull( att2, "attachment disappeared" );
+ Assertions.assertEquals( att.getName(), att2.getName(), "name" );
+ Assertions.assertEquals( att.getAuthor(), att2.getAuthor(), "author" );
+ Assertions.assertEquals( c_fileContents.length(), att2.getSize(), "size" );
InputStream in = m_manager.getAttachmentStream( att2 );
- Assert.assertNotNull( "stream", in );
+ Assertions.assertNotNull( in, "stream" );
StringWriter sout = new StringWriter();
FileUtil.copyContents( new InputStreamReader(in), sout );
@@ -154,7 +152,7 @@ public class AttachmentManagerTest
in.close();
sout.close();
- Assert.assertEquals( "contents", c_fileContents, sout.toString() );
+ Assertions.assertEquals( c_fileContents, sout.toString(), "contents" );
}
@Test
@@ -167,19 +165,17 @@ public class AttachmentManagerTest
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
- "test1.txt", 1 );
+ Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine, new WikiPage(m_engine, NAME1)), "test1.txt", 1 );
- Assert.assertNotNull( "attachment disappeared", att2 );
- Assert.assertEquals( "version", 1, att2.getVersion() );
- Assert.assertEquals( "name", att.getName(), att2.getName() );
- Assert.assertEquals( "author", att.getAuthor(), att2.getAuthor() );
- Assert.assertEquals( "size", c_fileContents.length(), att2.getSize() );
+ Assertions.assertNotNull( att2, "attachment disappeared" );
+ Assertions.assertEquals( 1, att2.getVersion(), "version" );
+ Assertions.assertEquals( att.getName(), att2.getName(), "name" );
+ Assertions.assertEquals( att.getAuthor(), att2.getAuthor(), "author" );
+ Assertions.assertEquals( c_fileContents.length(), att2.getSize(), "size" );
InputStream in = m_manager.getAttachmentStream( att2 );
- Assert.assertNotNull( "stream", in );
+ Assertions.assertNotNull( in, "stream" );
StringWriter sout = new StringWriter();
FileUtil.copyContents( new InputStreamReader(in), sout );
@@ -187,7 +183,7 @@ public class AttachmentManagerTest
in.close();
sout.close();
- Assert.assertEquals( "contents", c_fileContents, sout.toString() );
+ Assertions.assertEquals( c_fileContents, sout.toString(), "contents" );
}
@Test
@@ -203,18 +199,16 @@ public class AttachmentManagerTest
att.setAuthor( "FooBar" );
m_manager.storeAttachment( att, makeAttachmentFile() );
- Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
- "test1.txt" );
+ Attachment att2 = m_manager.getAttachmentInfo( new WikiContext(m_engine, new WikiPage(m_engine, NAME1)), "test1.txt" );
- Assert.assertNotNull( "attachment disappeared", att2 );
- Assert.assertEquals( "name", att.getName(), att2.getName() );
- Assert.assertEquals( "author", att.getAuthor(), att2.getAuthor() );
- Assert.assertEquals( "version", 2, att2.getVersion() );
+ Assertions.assertNotNull( att2, "attachment disappeared" );
+ Assertions.assertEquals( att.getName(), att2.getName(), "name" );
+ Assertions.assertEquals( att.getAuthor(), att2.getAuthor(), "author" );
+ Assertions.assertEquals( 2, att2.getVersion(), "version" );
InputStream in = m_manager.getAttachmentStream( att2 );
- Assert.assertNotNull( "stream", in );
+ Assertions.assertNotNull( in, "stream" );
StringWriter sout = new StringWriter();
FileUtil.copyContents( new InputStreamReader(in), sout );
@@ -222,19 +216,16 @@ public class AttachmentManagerTest
in.close();
sout.close();
- Assert.assertEquals( "contents", c_fileContents, sout.toString() );
+ Assertions.assertEquals( c_fileContents, sout.toString(), "contents" );
//
// Check that first author did not disappear
//
- Attachment att3 = m_manager.getAttachmentInfo( new WikiContext(m_engine,
- new WikiPage(m_engine, NAME1)),
- "test1.txt",
- 1 );
- Assert.assertEquals( "version of v1", 1, att3.getVersion() );
- Assert.assertEquals( "name of v1", "FirstPost", att3.getAuthor() );
+ Attachment att3 = m_manager.getAttachmentInfo( new WikiContext(m_engine, new WikiPage(m_engine, NAME1)), "test1.txt", 1 );
+ Assertions.assertEquals( 1, att3.getVersion(), "version of v1" );
+ Assertions.assertEquals( "FirstPost", att3.getAuthor(), "name of v1" );
}
@Test
@@ -249,12 +240,12 @@ public class AttachmentManagerTest
Collection<?> c = m_manager.listAttachments( new WikiPage(m_engine, NAME1) );
- Assert.assertEquals( "Length", 1, c.size() );
+ Assertions.assertEquals( 1, c.size(), "Length" );
Attachment att2 = (Attachment) c.toArray()[0];
- Assert.assertEquals( "name", att.getName(), att2.getName() );
- Assert.assertEquals( "author", att.getAuthor(), att2.getAuthor() );
+ Assertions.assertEquals( att.getName(), att2.getName(), "name" );
+ Assertions.assertEquals( att.getAuthor(), att2.getAuthor(), "author" );
}
@Test
@@ -270,15 +261,15 @@ public class AttachmentManagerTest
new WikiPage(m_engine, NAME1)),
"test1" );
- Assert.assertNotNull( "attachment disappeared", att2 );
- Assert.assertEquals( "name", att.getName(), att2.getName() );
- Assert.assertEquals( "author", "FirstPost", att2.getAuthor() );
- Assert.assertEquals( "size", c_fileContents.length(), att2.getSize() );
- Assert.assertEquals( "version", 1, att2.getVersion() );
+ Assertions.assertNotNull( att2, "attachment disappeared" );
+ Assertions.assertEquals( att.getName(), att2.getName(), "name" );
+ Assertions.assertEquals( att.getAuthor(), att2.getAuthor(), "author" );
+ Assertions.assertEquals( c_fileContents.length(), att2.getSize(), "size" );
+ Assertions.assertEquals( 1, att2.getVersion(), "version" );
InputStream in = m_manager.getAttachmentStream( att2 );
- Assert.assertNotNull( "stream", in );
+ Assertions.assertNotNull( in, "stream" );
StringWriter sout = new StringWriter();
FileUtil.copyContents( new InputStreamReader(in), sout );
@@ -286,7 +277,7 @@ public class AttachmentManagerTest
in.close();
sout.close();
- Assert.assertEquals( "contents", c_fileContents, sout.toString() );
+ Assertions.assertEquals( c_fileContents, sout.toString(), "contents" );
}
@@ -299,8 +290,7 @@ public class AttachmentManagerTest
m_manager.storeAttachment( att, makeAttachmentFile() );
- Assert.assertTrue( "attachment disappeared",
- m_engine.pageExists( NAME1+"/test1" ) );
+ Assertions.assertTrue( m_engine.pageExists( NAME1+"/test1" ), "attachment disappeared" );
}
@Test
@@ -312,8 +302,7 @@ public class AttachmentManagerTest
m_manager.storeAttachment( att, makeAttachmentFile() );
- Assert.assertTrue( "attachment disappeared",
- m_engine.pageExists( att.getName() ) );
+ Assertions.assertTrue( m_engine.pageExists( att.getName() ), "attachment disappeared" );
}
@Test
@@ -325,8 +314,7 @@ public class AttachmentManagerTest
m_manager.storeAttachment( att, makeAttachmentFile() );
- Assert.assertTrue( "attachment disappeared",
- m_engine.pageExists( NAME1+"/test file.bin" ) );
+ Assertions.assertTrue( m_engine.pageExists( NAME1+"/test file.bin" ), "attachment disappeared" );
}
@Test
@@ -338,8 +326,7 @@ public class AttachmentManagerTest
m_manager.storeAttachment( att, makeAttachmentFile() );
- Assert.assertTrue( "attachment disappeared",
- m_engine.pageExists( att.getName() ) );
+ Assertions.assertTrue( m_engine.pageExists( att.getName() ), "attachment disappeared" );
}
@Test
@@ -351,8 +338,7 @@ public class AttachmentManagerTest
m_manager.storeAttachment( att, makeAttachmentFile() );
- Assert.assertTrue( "attachment disappeared",
- m_engine.pageExists( att.getName() ) );
+ Assertions.assertTrue( m_engine.pageExists( att.getName() ), "attachment disappeared" );
}
@Test
@@ -367,7 +353,7 @@ public class AttachmentManagerTest
att.setAuthor("MonicaBellucci");
m_manager.storeAttachment( att, makeAttachmentFile() );
- Assert.fail("Attachment was stored even when the page does not exist");
+ Assertions.fail("Attachment was stored even when the page does not exist");
}
catch( ProviderException ex )
{
@@ -382,9 +368,9 @@ public class AttachmentManagerTest
@Test
public void testValidateFileName() throws Exception
{
- Assert.assertEquals( "foo.jpg", "foo.jpg", AttachmentManager.validateFileName( "foo.jpg" ) );
+ Assertions.assertEquals( "foo.jpg", AttachmentManager.validateFileName( "foo.jpg" ), "foo.jpg" );
- Assert.assertEquals( "C:\\Windows\\test.jpg", "test.jpg", AttachmentManager.validateFileName( "C:\\Windows\\test.jpg" ));
+ Assertions.assertEquals( "test.jpg", AttachmentManager.validateFileName( "C:\\Windows\\test.jpg" ), "C:\\Windows\\test.jpg" );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
index 8dc681a..803f1fd 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthenticationManagerTest.java
@@ -32,9 +32,9 @@ import org.apache.wiki.auth.authorize.GroupManager;
import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.authorize.WebAuthorizer;
import org.apache.wiki.auth.login.CookieAssertionLoginModule;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests the AuthorizationManager class.
@@ -87,7 +87,7 @@ public class AuthenticationManagerTest
private WikiSession m_session;
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -112,25 +112,25 @@ public class AuthenticationManagerTest
// Start a session without any container roles: DummyAuthorizer should ALWAYS allow AuthorizerRole
WikiSession session = WikiSessionTest.authenticatedSession( m_engine, Users.JANNE, Users.JANNE_PASS );
- Assert.assertTrue( session.hasPrincipal( Role.ALL ) );
- Assert.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( "Janne Jalkanen", WikiPrincipal.FULL_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new Role( "AuthorizerRole") ) );
- Assert.assertFalse( session.hasPrincipal( new Role( "ContainerRole") ) );
- Assert.assertFalse( session.hasPrincipal( new Role( "DummyRole") ) );
+ Assertions.assertTrue( session.hasPrincipal( Role.ALL ) );
+ Assertions.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( "Janne Jalkanen", WikiPrincipal.FULL_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new Role( "AuthorizerRole") ) );
+ Assertions.assertFalse( session.hasPrincipal( new Role( "ContainerRole") ) );
+ Assertions.assertFalse( session.hasPrincipal( new Role( "DummyRole") ) );
// Try again with a container-authenticated session: DummyAuthorizer should ALSO allow ContainerRole
session = WikiSessionTest.containerAuthenticatedSession( m_engine, Users.JANNE, new Principal[0] );
- Assert.assertTrue( session.hasPrincipal( Role.ALL ) );
- Assert.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( "Janne Jalkanen", WikiPrincipal.FULL_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new Role( "AuthorizerRole") ) );
- Assert.assertTrue( session.hasPrincipal( new Role( "ContainerRole") ) );
- Assert.assertFalse( session.hasPrincipal( new Role( "DummyRole") ) );
+ Assertions.assertTrue( session.hasPrincipal( Role.ALL ) );
+ Assertions.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( "Janne Jalkanen", WikiPrincipal.FULL_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new Role( "AuthorizerRole") ) );
+ Assertions.assertTrue( session.hasPrincipal( new Role( "ContainerRole") ) );
+ Assertions.assertFalse( session.hasPrincipal( new Role( "DummyRole") ) );
}
@Test
@@ -145,7 +145,7 @@ public class AuthenticationManagerTest
// login module
WikiEngine engine = new TestEngine( props );
AuthenticationManager authMgr = engine.getAuthenticationManager();
- Assert.assertEquals( CookieAssertionLoginModule.class, authMgr.m_loginModuleClass );
+ Assertions.assertEquals( CookieAssertionLoginModule.class, authMgr.m_loginModuleClass );
}
@Test
@@ -163,39 +163,39 @@ public class AuthenticationManagerTest
WikiEngine engine = new TestEngine( props );
AuthenticationManager authMgr = engine.getAuthenticationManager();
Map<String, String> options = authMgr.m_loginModuleOptions;
- Assert.assertEquals( 3, options.size() );
- Assert.assertTrue( options.containsKey( "key1" ) );
- Assert.assertTrue( options.containsKey( "key2" ) );
- Assert.assertTrue( options.containsKey( "key3" ) );
- Assert.assertEquals( "value1", options.get( "key1" ) );
- Assert.assertEquals( "value2", options.get( "key2" ) );
- Assert.assertEquals( "value3", options.get( "key3" ) );
+ Assertions.assertEquals( 3, options.size() );
+ Assertions.assertTrue( options.containsKey( "key1" ) );
+ Assertions.assertTrue( options.containsKey( "key2" ) );
+ Assertions.assertTrue( options.containsKey( "key3" ) );
+ Assertions.assertEquals( "value1", options.get( "key1" ) );
+ Assertions.assertEquals( "value2", options.get( "key2" ) );
+ Assertions.assertEquals( "value3", options.get( "key3" ) );
}
@Test
public void testIsUserPrincipal()
{
- Assert.assertTrue( AuthenticationManager.isUserPrincipal( new WikiPrincipal( "Foo" ) ) );
- Assert.assertFalse( AuthenticationManager.isUserPrincipal( new GroupPrincipal( "Group1" ) ) );
- Assert.assertFalse( AuthenticationManager.isUserPrincipal( new Role( "Role1" ) ) );
- Assert.assertFalse( AuthenticationManager.isUserPrincipal( Role.ANONYMOUS ) );
+ Assertions.assertTrue( AuthenticationManager.isUserPrincipal( new WikiPrincipal( "Foo" ) ) );
+ Assertions.assertFalse( AuthenticationManager.isUserPrincipal( new GroupPrincipal( "Group1" ) ) );
+ Assertions.assertFalse( AuthenticationManager.isUserPrincipal( new Role( "Role1" ) ) );
+ Assertions.assertFalse( AuthenticationManager.isUserPrincipal( Role.ANONYMOUS ) );
}
@Test
public void testLoginCustom() throws Exception
{
WikiSession session = WikiSessionTest.authenticatedSession( m_engine, Users.JANNE, Users.JANNE_PASS );
- Assert.assertTrue( session.hasPrincipal( Role.ALL ) );
- Assert.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( "Janne Jalkanen", WikiPrincipal.FULL_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( Role.ALL ) );
+ Assertions.assertTrue( session.hasPrincipal( Role.AUTHENTICATED ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( Users.JANNE, WikiPrincipal.LOGIN_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( "Janne Jalkanen", WikiPrincipal.FULL_NAME ) ) );
}
@Test
public void testLoginCustomWithGroup() throws Exception
{
- // Flush any pre-existing groups (left over from previous Assert.failures,
+ // Flush any pre-existing groups (left over from previous Assertions.failures,
// perhaps)
try
{
@@ -211,9 +211,9 @@ public class AuthenticationManagerTest
// (ALL, AUTHENTICATED, login, fullname, wikiname Principals)
WikiSession session = WikiSession.guestSession( m_engine );
m_auth.login( session, null, Users.JANNE, Users.JANNE_PASS );
- Assert.assertEquals( 3, session.getPrincipals().length );
- Assert.assertEquals( 2, session.getRoles().length );
- Assert.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertEquals( 3, session.getPrincipals().length );
+ Assertions.assertEquals( 2, session.getRoles().length );
+ Assertions.assertTrue( session.hasPrincipal( new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
// Listen for any manager group-add events
GroupManager manager = m_engine.getGroupManager();
@@ -233,27 +233,27 @@ public class AuthenticationManagerTest
// We should see two security events (one for each group create)
// We should also see a GroupPrincipal for group Test1, but not Test2
- Assert.assertEquals( 2, trap.events().length );
- Assert.assertTrue( session.hasPrincipal( principalTest1 ) );
- Assert.assertFalse( session.hasPrincipal( principalTest2 ) );
+ Assertions.assertEquals( 2, trap.events().length );
+ Assertions.assertTrue( session.hasPrincipal( principalTest1 ) );
+ Assertions.assertFalse( session.hasPrincipal( principalTest2 ) );
// If we remove Test1, the GroupPrincipal should disappear
m_groupMgr.removeGroup( "Test1" );
- Assert.assertFalse( session.hasPrincipal( principalTest1 ) );
- Assert.assertFalse( session.hasPrincipal( principalTest2 ) );
+ Assertions.assertFalse( session.hasPrincipal( principalTest1 ) );
+ Assertions.assertFalse( session.hasPrincipal( principalTest2 ) );
// Now, add 'JanneJalkanen' to Test2 group manually; we should see the
// GroupPrincipal
groupTest2.add( new WikiPrincipal( "JanneJalkanen" ) );
m_groupMgr.setGroup( session, groupTest2 );
- Assert.assertFalse( session.hasPrincipal( principalTest1 ) );
- Assert.assertTrue( session.hasPrincipal( principalTest2 ) );
+ Assertions.assertFalse( session.hasPrincipal( principalTest1 ) );
+ Assertions.assertTrue( session.hasPrincipal( principalTest2 ) );
// Remove 'JanneJalkenen' manually; the GroupPrincipal should disappear
groupTest2.remove( new WikiPrincipal( "JanneJalkanen" ) );
m_groupMgr.setGroup( session, groupTest2 );
- Assert.assertFalse( session.hasPrincipal( principalTest1 ) );
- Assert.assertFalse( session.hasPrincipal( principalTest2 ) );
+ Assertions.assertFalse( session.hasPrincipal( principalTest1 ) );
+ Assertions.assertFalse( session.hasPrincipal( principalTest2 ) );
// Clean up
m_groupMgr.removeGroup( "Test2" );
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java
index 7741d02..3cd0f67 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/AuthorizationManagerTest.java
@@ -39,9 +39,9 @@ import org.apache.wiki.auth.permissions.PagePermission;
import org.apache.wiki.auth.permissions.PermissionFactory;
import org.apache.wiki.auth.permissions.WikiPermission;
import org.apache.wiki.auth.user.UserProfile;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests the AuthorizationManager class.
@@ -71,7 +71,7 @@ public class AuthorizationManagerTest
}
}
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -103,13 +103,13 @@ public class AuthorizationManagerTest
// Alice is asserted
session = WikiSessionTest.assertedSession( m_engine, Users.ALICE );
- Assert.assertTrue( "Alice view", m_auth.checkPermission( session, view ) );
- Assert.assertTrue( "Alice edit", m_auth.checkPermission( session, edit ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice view" );
+ Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice edit" );
// Bob is logged in
session = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
- Assert.assertTrue( "Bob view", m_auth.checkPermission( session, view ) );
- Assert.assertTrue( "Bob edit", m_auth.checkPermission( session, edit ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, view ), "Bob view" );
+ Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Bob edit" );
// Delete the test page
try
@@ -118,7 +118,7 @@ public class AuthorizationManagerTest
}
catch( ProviderException e )
{
- Assert.assertTrue( false );
+ Assertions.fail( e.getMessage() );
}
}
@@ -137,10 +137,10 @@ public class AuthorizationManagerTest
// Bob should have two roles: ASSERTED and ALL
principals = session.getRoles();
- Assert.assertTrue( "Bob in ALL", ArrayUtils.contains( principals, Role.ALL ) );
- Assert.assertTrue( "Bob in ASSERTED", ArrayUtils.contains( principals, Role.ASSERTED ) );
- Assert.assertFalse( "Bob not in ANONYMOUS", ArrayUtils.contains( principals, Role.ANONYMOUS ) );
- Assert.assertFalse( "Bob not in Test", ArrayUtils.contains( principals, test.getPrincipal() ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ALL ), "Bob in ALL" );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ASSERTED ), "Bob in ASSERTED" );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ANONYMOUS ), "Bob not in ANONYMOUS" );
+ Assertions.assertFalse( ArrayUtils.contains( principals, test.getPrincipal() ), "Bob not in Test" );
// Re-save group "Test" with Bob as a member
test = m_groupMgr.parseGroup( "Test", "Alice \n Bob \nCharlie", true );
@@ -148,10 +148,10 @@ public class AuthorizationManagerTest
// Bob not authenticated: should still have only two romes
principals = session.getRoles();
- Assert.assertTrue( "Bob in ALL", ArrayUtils.contains( principals, Role.ALL ) );
- Assert.assertTrue( "Bob in ASSERTED", ArrayUtils.contains( principals, Role.ASSERTED ) );
- Assert.assertFalse( "Bob not in ANONYMOUS", ArrayUtils.contains( principals, Role.ANONYMOUS ) );
- Assert.assertFalse( "Bob in Test", ArrayUtils.contains( principals, test.getPrincipal() ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ALL ), "Bob in ALL" );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ASSERTED ), "Bob in ASSERTED" );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ANONYMOUS ), "Bob not in ANONYMOUS" );
+ Assertions.assertFalse( ArrayUtils.contains( principals, test.getPrincipal() ), "Bob in Test" );
// Elevate Bob to "authenticated" status
session = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
@@ -160,10 +160,10 @@ public class AuthorizationManagerTest
test = m_groupMgr.parseGroup( "Test", "Alice \n Bob \n Charlie", true );
m_groupMgr.setGroup( m_session, test );
principals = session.getRoles();
- Assert.assertTrue( "Bob in ALL", ArrayUtils.contains( principals, Role.ALL ) );
- Assert.assertFalse( "Bob in ASSERTED", ArrayUtils.contains( principals, Role.ASSERTED ) );
- Assert.assertFalse( "Bob not in ANONYMOUS", ArrayUtils.contains( principals, Role.ANONYMOUS ) );
- Assert.assertTrue( "Bob in Test", ArrayUtils.contains( principals, test.getPrincipal() ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, Role.ALL ), "Bob in ALL" );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ASSERTED ), "Bob in ASSERTED" );
+ Assertions.assertFalse( ArrayUtils.contains( principals, Role.ANONYMOUS ), "Bob not in ANONYMOUS" );
+ Assertions.assertTrue( ArrayUtils.contains( principals, test.getPrincipal() ), "Bob in Test" );
// Cleanup
m_groupMgr.removeGroup( "Test" );
@@ -192,25 +192,25 @@ public class AuthorizationManagerTest
// Test user principal posession: Alice isn't considered to
// have the "Alice" principal because she's not authenticated
- Assert.assertFalse ( "Alice has Alice", m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.ALICE ) ) );
- Assert.assertFalse ( "Alice has Alice", m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.ALICE ) ) );
- Assert.assertFalse( "Alice not has Bob", m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.BOB ) ) );
- Assert.assertFalse( "Alice not has Bob", m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.BOB ) ) );
+ Assertions.assertFalse ( m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.ALICE ) ), "Alice has Alice" );
+ Assertions.assertFalse ( m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.ALICE ) ), "Alice has Alice" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.BOB ) ), "Alice not has Bob" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.BOB ) ), "Alice not has Bob" );
// Built-in role memberships
- Assert.assertTrue( "Alice in ALL", m_auth.hasRoleOrPrincipal( session, Role.ALL ) );
- Assert.assertFalse( "Alice not in ANONYMOUS", m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ) );
- Assert.assertTrue( "Alice in ASSERTED", m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ) );
- Assert.assertFalse( "Alice not in AUTHENTICATED", m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ) );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, Role.ALL ), "Alice in ALL" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ), "Alice not in ANONYMOUS" );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ), "Alice in ASSERTED" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ), "Alice not in AUTHENTICATED" );
// Custom roles should be FALSE because Alice is asserted
- Assert.assertFalse( "Alice not in IT", m_auth.hasRoleOrPrincipal( session, it ) );
- Assert.assertFalse( "Alice not in Engineering", m_auth.hasRoleOrPrincipal( session, engineering ) );
- Assert.assertFalse( "Alice not in Finance", m_auth.hasRoleOrPrincipal( session, finance ) );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, it ), "Alice not in IT" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, engineering ), "Alice not in Engineering" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, finance ), "Alice not in Finance" );
// Group memberships should be FALSE because Alice is asserted
- Assert.assertFalse( "Alice not in Foo", m_auth.hasRoleOrPrincipal( session, fooGroup.getPrincipal() ) );
- Assert.assertFalse( "Alice not in Bar", m_auth.hasRoleOrPrincipal( session, barGroup.getPrincipal() ) );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, fooGroup.getPrincipal() ), "Alice not in Foo" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, barGroup.getPrincipal() ), "Alice not in Bar" );
// Clean up
m_groupMgr.removeGroup( "Foo" );
@@ -240,25 +240,25 @@ public class AuthorizationManagerTest
// Test user principal posession: user principals of different
// types should still be "the same" if their names are equal
- Assert.assertTrue( "Alice has Alice", m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.ALICE ) ) );
- Assert.assertTrue( "Alice has Alice", m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.ALICE ) ) );
- Assert.assertFalse( "Alice not has Bob", m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.BOB ) ) );
- Assert.assertFalse( "Alice not has Bob", m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.BOB ) ) );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.ALICE ) ), "Alice has Alice" );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.ALICE ) ), "Alice has Alice" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, new WikiPrincipal( Users.BOB ) ), "Alice not has Bob" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, new TestPrincipal( Users.BOB ) ), "Alice not has Bob" );
// Built-in role membership
- Assert.assertTrue( "Alice in ALL", m_auth.hasRoleOrPrincipal( session, Role.ALL ) );
- Assert.assertFalse( "Alice not in ANONYMOUS", m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ) );
- Assert.assertFalse( "Alice not in ASSERTED", m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ) );
- Assert.assertTrue( "Alice in AUTHENTICATED", m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ) );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, Role.ALL ), "Alice in ALL" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ), "Alice not in ANONYMOUS" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ), "Alice not in ASSERTED" );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ), "Alice in AUTHENTICATED" );
// Custom roles
- Assert.assertTrue( "Alice in IT", m_auth.hasRoleOrPrincipal( session, it ) );
- Assert.assertTrue( "Alice in Engineering", m_auth.hasRoleOrPrincipal( session, engineering ) );
- Assert.assertFalse( "Alice not in Finance", m_auth.hasRoleOrPrincipal( session, finance ) );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, it ), "Alice in IT" );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, engineering ), "Alice in Engineering" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, finance ), "Alice not in Finance" );
// Group memberships
- Assert.assertFalse( "Alice not in Foo", m_auth.hasRoleOrPrincipal( session, fooGroup.getPrincipal() ) );
- Assert.assertTrue( "Alice in Bar", m_auth.hasRoleOrPrincipal( session, barGroup.getPrincipal() ) );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, fooGroup.getPrincipal() ), "Alice not in Foo" );
+ Assertions.assertTrue( m_auth.hasRoleOrPrincipal( session, barGroup.getPrincipal() ), "Alice in Bar" );
// Cleanup
m_groupMgr.removeGroup( "Foo" );
@@ -284,13 +284,13 @@ public class AuthorizationManagerTest
// Create authenticated session with user 'Alice', who can read & edit (in ACL)
WikiSession session;
session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, Users.ALICE_PASS );
- Assert.assertTrue( "Alice view Test/test1.txt", m_auth.checkPermission( session, view ) );
- Assert.assertTrue( "Alice edit Test/test1.txt", m_auth.checkPermission( session, edit ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice view Test/test1.txt" );
+ Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice view Test/test1.txt" );
// Create authenticated session with user 'Bob', who can't read or edit (not in ACL)
session = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
- Assert.assertFalse( "Bob !view Test/test1.txt", m_auth.checkPermission( session, view ) );
- Assert.assertFalse( "Bob !edit Test/test1.txt", m_auth.checkPermission( session, edit ) );
+ Assertions.assertFalse( m_auth.checkPermission( session, view ), "Bob !view Test/test1.txt" );
+ Assertions.assertFalse( m_auth.checkPermission( session, edit ), "Bob !view Test/test1.txt" );
// Delete test page & attachment
m_engine.getAttachmentManager().deleteAttachment( att );
@@ -316,13 +316,13 @@ public class AuthorizationManagerTest
// Create session with user 'Alice', who can read (in ACL)
WikiSession session;
session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, Users.ALICE_PASS );
- Assert.assertTrue( "Foo view Test", m_auth.checkPermission( session, view ) );
- Assert.assertFalse( "Foo !edit Test", m_auth.checkPermission( session, edit ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, view ), "Foo view Test" );
+ Assertions.assertFalse( m_auth.checkPermission( session, edit ),"Foo !edit Test" );
// Create session with user 'Bob', who can't read or edit (not in ACL)
session = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
- Assert.assertFalse( "Bar !view Test", m_auth.checkPermission( session, view ) );
- Assert.assertFalse( "Bar !edit Test", m_auth.checkPermission( session, view ) );
+ Assertions.assertFalse( m_auth.checkPermission( session, view ),"Bar !view Test" );
+ Assertions.assertFalse( m_auth.checkPermission( session, view ), "Bar !edit Test" );
// Delete test page & attachment
m_engine.getAttachmentManager().deleteAttachment( att );
@@ -348,38 +348,38 @@ public class AuthorizationManagerTest
// Create anonymous session; not in ANY custom roles or groups
session = WikiSessionTest.anonymousSession( m_engine );
- Assert.assertTrue ( "Anon anonymous", m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ) );
- Assert.assertFalse( "Anon not asserted", m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ) );
- Assert.assertFalse( "Anon not authenticated", m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ) );
- Assert.assertFalse( "Alice not in Anon", m_auth.hasRoleOrPrincipal( session, alice ) );
- Assert.assertFalse( "Anon not in IT", m_auth.hasRoleOrPrincipal( session, it ) );
- Assert.assertFalse( "Anon not in Finance", m_auth.hasRoleOrPrincipal( session, finance ) );
- Assert.assertFalse( "Anon not in Group1", m_auth.hasRoleOrPrincipal( session, group1 ) );
- Assert.assertFalse( "Anon not in Group2", m_auth.hasRoleOrPrincipal( session, group2 ) );
+ Assertions.assertTrue ( m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ), "Anon anonymous" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ), "Anon not asserted" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ), "Anon not authenticated" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, alice ), "Alice not in Anon" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, it ), "Anon not in IT" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, finance ), "Anon not in Finance" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, group1 ), "Anon not in Group1" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, group2 ), "Anon not in Group2" );
// Create asserted session with 1 GroupPrincipal & 1 custom Role
// Alice is asserted, and thus not in ANY custom roles or groups
session = WikiSessionTest.assertedSession( m_engine, Users.ALICE, new Principal[] { it } );
- Assert.assertFalse( "Alice not anonymous", m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ) );
- Assert.assertTrue ( "Alice asserted", m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ) );
- Assert.assertFalse( "Alice not authenticated", m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ) );
- Assert.assertFalse( "Alice not in Alice", m_auth.hasRoleOrPrincipal( session, alice ) );
- Assert.assertFalse( "Alice not in IT", m_auth.hasRoleOrPrincipal( session, it ) );
- Assert.assertFalse( "Alice not in Finance", m_auth.hasRoleOrPrincipal( session, finance ) );
- Assert.assertFalse( "Alice not in Group1", m_auth.hasRoleOrPrincipal( session, group1 ) );
- Assert.assertFalse( "Alice not in Group2", m_auth.hasRoleOrPrincipal( session, group2 ) );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ), "Alice not anonymous" );
+ Assertions.assertTrue ( m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ), "Alice asserted" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ), "Alice not authenticated" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, alice ), "Alice not in Alice" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, it ), "Alice not in IT" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, finance ), "Alice not in Finance" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, group1 ), "Alice not in Group1" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, group2 ), "Alice not in Group2" );
// Create authenticated session with 1 GroupPrincipal & 1 custom Role
// Alice is authenticated, and thus part of custom roles and groups
session = WikiSessionTest.containerAuthenticatedSession( m_engine, Users.ALICE, new Principal[] { it } );
- Assert.assertFalse( "Alice not anonymous", m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ) );
- Assert.assertFalse( "Alice not asserted", m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ) );
- Assert.assertTrue ( "Alice authenticated", m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ) );
- Assert.assertTrue ( "Alice in Ernie", m_auth.hasRoleOrPrincipal( session, alice ) );
- Assert.assertTrue ( "Alice in IT", m_auth.hasRoleOrPrincipal( session, it ) );
- Assert.assertFalse( "Alice not in Finance", m_auth.hasRoleOrPrincipal( session, finance ) );
- Assert.assertTrue ( "Alice in Group1", m_auth.hasRoleOrPrincipal( session, group1 ) );
- Assert.assertFalse( "Alice not in Group2", m_auth.hasRoleOrPrincipal( session, group2 ) );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.ANONYMOUS ), "Alice not anonymous" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, Role.ASSERTED ), "Alice not asserted" );
+ Assertions.assertTrue ( m_auth.hasRoleOrPrincipal( session, Role.AUTHENTICATED ), "Alice authenticated" );
+ Assertions.assertTrue ( m_auth.hasRoleOrPrincipal( session, alice ), "Alice in Ernie" );
+ Assertions.assertTrue ( m_auth.hasRoleOrPrincipal( session, it ), "Alice in IT" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, finance ), "Alice not in Finance" );
+ Assertions.assertTrue ( m_auth.hasRoleOrPrincipal( session, group1 ), "Alice in Group1" );
+ Assertions.assertFalse( m_auth.hasRoleOrPrincipal( session, group2 ), "Alice not in Group2" );
// Clean up
m_groupMgr.removeGroup( "Group1" );
@@ -405,38 +405,38 @@ public class AuthorizationManagerTest
// Create anonymous session; not in ANY custom roles or groups
session = WikiSessionTest.anonymousSession( m_engine );
- Assert.assertTrue ( "Anon anonymous", m_auth.isUserInRole( session, Role.ANONYMOUS ) );
- Assert.assertFalse( "Anon not asserted", m_auth.isUserInRole( session, Role.ASSERTED ) );
- Assert.assertFalse( "Anon not authenticated", m_auth.isUserInRole( session, Role.AUTHENTICATED ) );
- Assert.assertFalse( "Anon not in Ernie", m_auth.isUserInRole( session, alice ) );
- Assert.assertFalse( "Anon not in IT", m_auth.isUserInRole( session, it ) );
- Assert.assertFalse( "Anon not in Finance", m_auth.isUserInRole( session, finance ) );
- Assert.assertFalse( "Anon not in Group1", m_auth.isUserInRole( session, group1 ) );
- Assert.assertFalse( "Anon not in Group2", m_auth.isUserInRole( session, group2 ) );
+ Assertions.assertTrue ( m_auth.isUserInRole( session, Role.ANONYMOUS ), "Anon anonymous" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, Role.ASSERTED ), "Anon not asserted" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, Role.AUTHENTICATED ), "Anon not authenticated" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, alice ), "Anon not in Ernie" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, it ), "Anon not in IT" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, finance ), "Anon not in Finance" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, group1 ), "Anon not in Group1" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, group2 ), "Anon not in Group2" );
// Create asserted session with 1 GroupPrincipal & 1 custom Role
// Alice is asserted, and thus not in ANY custom roles or groups
session = WikiSessionTest.assertedSession( m_engine, Users.ALICE, new Principal[] { it } );
- Assert.assertFalse( "Alice not anonymous", m_auth.isUserInRole( session, Role.ANONYMOUS ) );
- Assert.assertTrue ( "Alice asserted", m_auth.isUserInRole( session, Role.ASSERTED ) );
- Assert.assertFalse( "Alice not authenticated", m_auth.isUserInRole( session, Role.AUTHENTICATED ) );
- Assert.assertFalse( "Alice not in Alice", m_auth.isUserInRole( session, alice ) );
- Assert.assertFalse( "Alice not in IT", m_auth.isUserInRole( session, it ) );
- Assert.assertFalse( "Alice not in Finance", m_auth.isUserInRole( session, finance ) );
- Assert.assertFalse( "Alice not in Group1", m_auth.isUserInRole( session, group1 ) );
- Assert.assertFalse( "Alice not in Group2", m_auth.isUserInRole( session, group2 ) );
+ Assertions.assertFalse( m_auth.isUserInRole( session, Role.ANONYMOUS ), "Alice not anonymous" );
+ Assertions.assertTrue ( m_auth.isUserInRole( session, Role.ASSERTED ), "Alice asserted" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, Role.AUTHENTICATED ), "Alice not authenticated" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, alice ), "Alice not in Alice" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, it ), "Alice not in IT" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, finance ), "Alice not in Finance" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, group1 ), "Alice not in Group1" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, group2 ), "Alice not in Group2" );
// Create authenticated session with 1 GroupPrincipal & 1 custom Role
// Ernie is authenticated, and thus part of custom roles and groups
session = WikiSessionTest.containerAuthenticatedSession( m_engine, Users.ALICE, new Principal[] { it } );
- Assert.assertFalse( "Alice not anonymous", m_auth.isUserInRole( session, Role.ANONYMOUS ) );
- Assert.assertFalse( "Alice not asserted", m_auth.isUserInRole( session, Role.ASSERTED ) );
- Assert.assertTrue ( "Alice not authenticated", m_auth.isUserInRole( session, Role.AUTHENTICATED ) );
- Assert.assertFalse( "Alice not in Alice", m_auth.isUserInRole( session, alice ) );
- Assert.assertTrue ( "Alice in IT", m_auth.isUserInRole( session, it ) );
- Assert.assertFalse( "Alice not in Finance", m_auth.isUserInRole( session, finance ) );
- Assert.assertTrue ( "Alice in Group1", m_auth.isUserInRole( session, group1 ) );
- Assert.assertFalse( "Alice not in Group2", m_auth.isUserInRole( session, group2 ) );
+ Assertions.assertFalse( m_auth.isUserInRole( session, Role.ANONYMOUS ), "Alice not anonymous" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, Role.ASSERTED ), "Alice not asserted" );
+ Assertions.assertTrue ( m_auth.isUserInRole( session, Role.AUTHENTICATED ), "Alice not authenticated" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, alice ), "Alice not in Alice" );
+ Assertions.assertTrue ( m_auth.isUserInRole( session, it ), "Alice in IT" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, finance ), "Alice not in Finance" );
+ Assertions.assertTrue ( m_auth.isUserInRole( session, group1 ), "Alice in Group1" );
+ Assertions.assertFalse( m_auth.isUserInRole( session, group2 ), "Alice not in Group2" );
// Clean up
m_groupMgr.removeGroup( "Group1" );
@@ -457,13 +457,13 @@ public class AuthorizationManagerTest
// Create session with authenticated user 'Alice', who can read & edit (in ACL)
WikiSession session;
session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, Users.ALICE_PASS );
- Assert.assertTrue( "Alice view Test", m_auth.checkPermission( session, view ) );
- Assert.assertTrue( "Alice edit Test", m_auth.checkPermission( session, edit ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice view Test" );
+ Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice edit Test" );
// Create session with authenticated user 'Bob', who can't read or edit (not in ACL)
session = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
- Assert.assertFalse( "Bob !view Test", m_auth.checkPermission( session, view ) );
- Assert.assertFalse( "Bob !edit Test", m_auth.checkPermission( session, edit ) );
+ Assertions.assertFalse( m_auth.checkPermission( session, view ), "Bob !view Test" );
+ Assertions.assertFalse( m_auth.checkPermission( session, edit ), "Bob !edit Test" );
// Cleanup
try
@@ -472,7 +472,7 @@ public class AuthorizationManagerTest
}
catch( ProviderException e )
{
- Assert.fail( "Could not delete page" );
+ Assertions.fail( "Could not delete page" );
}
}
@@ -484,17 +484,17 @@ public class AuthorizationManagerTest
public void testResolveBuiltInRoles()
{
Principal principal = Role.AUTHENTICATED;
- Assert.assertEquals( principal, m_auth.resolvePrincipal( "Authenticated" ) );
+ Assertions.assertEquals( principal, m_auth.resolvePrincipal( "Authenticated" ) );
principal = Role.ASSERTED;
- Assert.assertEquals( principal, m_auth.resolvePrincipal( "Asserted" ) );
+ Assertions.assertEquals( principal, m_auth.resolvePrincipal( "Asserted" ) );
principal = Role.ALL;
- Assert.assertEquals( principal, m_auth.resolvePrincipal( "All" ) );
+ Assertions.assertEquals( principal, m_auth.resolvePrincipal( "All" ) );
principal = Role.ANONYMOUS;
- Assert.assertEquals( principal, m_auth.resolvePrincipal( "Anonymous" ) );
+ Assertions.assertEquals( principal, m_auth.resolvePrincipal( "Anonymous" ) );
// This should not resolve because there's no built-in role Admin
principal = new WikiPrincipal( "Admin" );
- Assert.assertFalse( principal.equals( m_auth.resolvePrincipal( "Admin" ) ) );
+ Assertions.assertFalse( principal.equals( m_auth.resolvePrincipal( "Admin" ) ) );
}
@Test
@@ -503,20 +503,20 @@ public class AuthorizationManagerTest
Group group1 = m_groupMgr.parseGroup( "SampleGroup", "", true );
m_groupMgr.setGroup( m_session, group1 );
- Assert.assertEquals( group1.getPrincipal(), m_auth.resolvePrincipal( "SampleGroup" ) );
+ Assertions.assertEquals( group1.getPrincipal(), m_auth.resolvePrincipal( "SampleGroup" ) );
m_groupMgr.removeGroup( "SampleGroup" );
// We shouldn't be able to spoof a built-in role
try
{
Group group2 = m_groupMgr.parseGroup( "Authenticated", "", true );
- Assert.assertNotSame( group2.getPrincipal(), m_auth.resolvePrincipal( "Authenticated" ) );
+ Assertions.assertNotSame( group2.getPrincipal(), m_auth.resolvePrincipal( "Authenticated" ) );
}
catch ( WikiSecurityException e )
{
- Assert.assertTrue ( "Authenticated not allowed as group name.", true );
+ Assertions.assertTrue ( true, "Authenticated not allowed as group name." );
}
- Assert.assertEquals( Role.AUTHENTICATED, m_auth.resolvePrincipal( "Authenticated" ) );
+ Assertions.assertEquals( Role.AUTHENTICATED, m_auth.resolvePrincipal( "Authenticated" ) );
}
@Test
@@ -533,36 +533,36 @@ public class AuthorizationManagerTest
}
catch( WikiSecurityException e )
{
- Assert.fail( "Failed save: " + e.getLocalizedMessage() );
+ Assertions.fail( "Failed save: " + e.getLocalizedMessage() );
}
- Assert.assertEquals( new WikiPrincipal( "authmanagertest", WikiPrincipal.LOGIN_NAME ), m_auth.resolvePrincipal( "authmanagertest" ) );
- Assert.assertEquals( new WikiPrincipal( "AuthorizationManagerTest User", WikiPrincipal.FULL_NAME ), m_auth.resolvePrincipal( "AuthorizationManagerTest User" ) );
- Assert.assertEquals( new WikiPrincipal( "AuthorizationManagerTestUser", WikiPrincipal.WIKI_NAME ), m_auth.resolvePrincipal( "AuthorizationManagerTestUser" ) );
+ Assertions.assertEquals( new WikiPrincipal( "authmanagertest", WikiPrincipal.LOGIN_NAME ), m_auth.resolvePrincipal( "authmanagertest" ) );
+ Assertions.assertEquals( new WikiPrincipal( "AuthorizationManagerTest User", WikiPrincipal.FULL_NAME ), m_auth.resolvePrincipal( "AuthorizationManagerTest User" ) );
+ Assertions.assertEquals( new WikiPrincipal( "AuthorizationManagerTestUser", WikiPrincipal.WIKI_NAME ), m_auth.resolvePrincipal( "AuthorizationManagerTestUser" ) );
try
{
m_engine.getUserManager().getUserDatabase().deleteByLoginName( "authmanagertest" );
}
catch( WikiSecurityException e )
{
- Assert.fail( "Failed delete: " + e.getLocalizedMessage() );
+ Assertions.fail( "Failed delete: " + e.getLocalizedMessage() );
}
// A wiki group should resolve to itself
Group group1 = m_groupMgr.parseGroup( "SampleGroup", "", true );
m_groupMgr.setGroup( m_session, group1 );
- Assert.assertEquals( group1.getPrincipal(), m_auth.resolvePrincipal( "SampleGroup" ) );
+ Assertions.assertEquals( group1.getPrincipal(), m_auth.resolvePrincipal( "SampleGroup" ) );
m_groupMgr.removeGroup( "SampleGroup" );
// A built-in role should resolve to itself
- Assert.assertEquals( Role.AUTHENTICATED, m_auth.resolvePrincipal( "Authenticated" ) );
+ Assertions.assertEquals( Role.AUTHENTICATED, m_auth.resolvePrincipal( "Authenticated" ) );
// We shouldn't be able to spoof a built-in role
- Assert.assertNotSame( new WikiPrincipal( "Authenticated" ), m_auth.resolvePrincipal( "Authenticated" ) );
+ Assertions.assertNotSame( new WikiPrincipal( "Authenticated" ), m_auth.resolvePrincipal( "Authenticated" ) );
// An unknown user should resolve to a generic UnresolvedPrincipal
Principal principal = new UnresolvedPrincipal( "Bart Simpson" );
- Assert.assertEquals( principal, m_auth.resolvePrincipal( "Bart Simpson" ) );
+ Assertions.assertEquals( principal, m_auth.resolvePrincipal( "Bart Simpson" ) );
}
@Test
@@ -579,13 +579,13 @@ public class AuthorizationManagerTest
// Create session with authenticated user 'Alice', who can read & edit
WikiSession session;
session = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, Users.ALICE_PASS );
- Assert.assertTrue( "Alice view Test", m_auth.checkPermission( session, view ) );
- Assert.assertTrue( "Alice edit Test", m_auth.checkPermission( session, edit ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, view ), "Alice view Test" );
+ Assertions.assertTrue( m_auth.checkPermission( session, edit ), "Alice edit Test" );
// Create session with asserted user 'Bob', who can't read or edit (not in ACL)
session = WikiSessionTest.assertedSession( m_engine, Users.BOB );
- Assert.assertFalse( "Bob !view Test", m_auth.checkPermission( session, view ) );
- Assert.assertFalse( "Bob !edit Test", m_auth.checkPermission( session, edit ) );
+ Assertions.assertFalse( m_auth.checkPermission( session, view ), "Bob !view Test" );
+ Assertions.assertFalse( m_auth.checkPermission( session, edit ), "Bob !edit Test" );
// Cleanup
try
@@ -594,7 +594,7 @@ public class AuthorizationManagerTest
}
catch( ProviderException e )
{
- Assert.assertTrue( false );
+ Assertions.fail( e.getMessage() );
}
}
@@ -602,58 +602,58 @@ public class AuthorizationManagerTest
public void testStaticPermission() throws Exception
{
WikiSession s = WikiSessionTest.anonymousSession( m_engine );
- Assert.assertTrue( "Anonymous view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertTrue( "Anonymous edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertTrue( "Anonymous comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertFalse( "Anonymous modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertFalse( "Anonymous upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertFalse( "Anonymous rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertFalse( "Anonymous delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertTrue( "Anonymous prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertTrue( "Anonymous profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertTrue( "Anonymous pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertFalse( "Anonymous groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Anonymous view" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Anonymous edit" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Anonymous comment" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Anonymous modify" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Anonymous upload" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Anonymous rename" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Anonymous delete" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Anonymous prefs" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Anonymous profile" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Anonymous pages" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Anonymous groups" );
s = WikiSessionTest.assertedSession( m_engine, "Jack Sparrow" );
- Assert.assertTrue( "Asserted view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertTrue( "Asserted edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertTrue( "Asserted comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertFalse( "Asserted modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertFalse( "Asserted upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertFalse( "Asserted rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertFalse( "Asserted delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertTrue( "Asserted prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertTrue( "Asserted profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertTrue( "Asserted pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertFalse( "Asserted groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Asserted view" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Asserted edit" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Asserted comment" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Asserted modify" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Asserted upload" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Asserted rename" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Asserted delete" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Asserted prefs" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Asserted profile" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Asserted pages" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Asserted groups" );
s = WikiSessionTest.authenticatedSession( m_engine, Users.JANNE, Users.JANNE_PASS );
- Assert.assertTrue( "Authenticated view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertTrue( "Authenticated edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertTrue( "Authenticated comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertTrue( "Authenticated modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertTrue( "Authenticated upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertTrue( "Authenticated rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertFalse( "Authenticated delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertTrue( "Authenticated prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertTrue( "Authenticated profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertTrue( "Authenticated pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertTrue( "Authenticated groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Authenticated view" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Authenticated edit" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Authenticated comment" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Authenticated modify" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Authenticated upload" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Authenticated rename" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.DELETE ),"Authenticated delete" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Authenticated prefs" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Authenticated profile" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Authenticated pages" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Authenticated groups" );
s = WikiSessionTest.adminSession( m_engine );
- Assert.assertTrue( "Admin view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertTrue( "Admin edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertTrue( "Admin comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertTrue( "Admin modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertTrue( "Admin upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertTrue( "Admin rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Admin view" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Admin edit" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Admin comment" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Admin modify" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Admin upload" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Admin rename" );
// Even though we grant AllPermission in the policy, 'delete' isn't explicit so the check
- // for delete privileges will Assert.fail (but it will succeed if requested via the checkPermission())
- Assert.assertFalse( "Admin delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertTrue( "Admin prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertTrue( "Admin profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertTrue( "Admin pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertTrue( "Admin groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ // for delete privileges will Assertions.fail (but it will succeed if requested via the checkPermission())
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Admin delete" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Admin prefs" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Admin profile" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Admin pages" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Admin groups" );
}
@Test
@@ -668,10 +668,8 @@ public class AuthorizationManagerTest
Users.ALICE,
new Principal[] { admin } );
- Assert.assertTrue( "Alice has AllPermission", m_auth.checkPermission( session,
- new AllPermission( m_engine.getApplicationName() )));
- Assert.assertTrue( "Alice cannot read", m_auth.checkPermission( session,
- new PagePermission("TestDefaultPage","view") ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, new AllPermission( m_engine.getApplicationName() ) ), "Alice has AllPermission" );
+ Assertions.assertTrue( m_auth.checkPermission( session, new PagePermission("TestDefaultPage","view") ), "Alice cannot read" );
}
@Test
@@ -681,10 +679,8 @@ public class AuthorizationManagerTest
WikiSession session = WikiSessionTest.adminSession(m_engine);
- Assert.assertTrue( "Alice has AllPermission", m_auth.checkPermission( session,
- new AllPermission( m_engine.getApplicationName() )));
- Assert.assertTrue( "Alice cannot read", m_auth.checkPermission( session,
- new PagePermission("TestDefaultPage","view") ) );
+ Assertions.assertTrue( m_auth.checkPermission( session, new AllPermission( m_engine.getApplicationName() ) ), "Alice has AllPermission" );
+ Assertions.assertTrue( m_auth.checkPermission( session, new PagePermission("TestDefaultPage","view") ),"Alice cannot read" );
}
@Test
@@ -702,69 +698,69 @@ public class AuthorizationManagerTest
m_session = WikiSessionTest.adminSession( m_engine );
WikiSession s = WikiSessionTest.anonymousSession( m_engine );
- Assert.assertFalse( "Anonymous view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertFalse( "Anonymous edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertFalse( "Anonymous comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertFalse( "Anonymous modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertFalse( "Anonymous upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertFalse( "Anonymous rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertFalse( "Anonymous delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertFalse( "Anonymous prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertFalse( "Anonymous profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertFalse( "Anonymous pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertFalse( "Anonymous groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Anonymous view" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Anonymous edit" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Anonymous comment" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Anonymous modify" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Anonymous upload" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Anonymous rename" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Anonymous delete" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Anonymous prefs" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Anonymous profile" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Anonymous pages" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Anonymous groups" );
s = WikiSessionTest.assertedSession( m_engine, "Jack Sparrow" );
- Assert.assertFalse( "Asserted view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertFalse( "Asserted edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertFalse( "Asserted comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertFalse( "Asserted modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertFalse( "Asserted upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertFalse( "Asserted rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertFalse( "Asserted delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertFalse( "Asserted prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertFalse( "Asserted profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertFalse( "Asserted pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertFalse( "Asserted groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Asserted view" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Asserted edit" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Asserted comment" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Asserted modify" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Asserted upload" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Asserted rename" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Asserted delete" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Asserted prefs" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Asserted profile" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Asserted pages" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Asserted groups" );
s = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
- Assert.assertTrue( "Bob view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertTrue( "Bob edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertTrue( "Bob comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertTrue( "Bob modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertTrue( "Bob upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertFalse( "Bob rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertTrue( "Bob delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertFalse( "Bob prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertFalse( "Bob profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertFalse( "Bob pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertFalse( "Bob groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Bob view" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Bob edit" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Bob comment" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Bob modify" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Bob upload" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Bob rename" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Bob delete" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Bob prefs" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Bob profile" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Bob pages" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Bob groups" );
s = WikiSessionTest.authenticatedSession( m_engine, Users.JANNE, Users.JANNE_PASS );
- Assert.assertTrue( "Janne view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertTrue( "Janne edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertTrue( "Janne comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertTrue( "Janne modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertTrue( "Janne upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertFalse( "Janne rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertTrue( "Janne delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertFalse( "Janne prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertFalse( "Janne profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertFalse( "Janne pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertFalse( "Janne groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Janne view" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Janne edit" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Janne comment" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Janne modify" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Janne upload" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Janne rename" );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Janne delete" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Janne prefs" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Janne profile" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Janne pages" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Janne groups" );
s = WikiSessionTest.adminSession( m_engine );
- Assert.assertTrue( "Admin view", m_auth.checkStaticPermission( s, PagePermission.VIEW ) );
- Assert.assertFalse( "Admin edit", m_auth.checkStaticPermission( s, PagePermission.EDIT ) );
- Assert.assertFalse( "Admin comment", m_auth.checkStaticPermission( s, PagePermission.COMMENT ) );
- Assert.assertFalse( "Admin modify", m_auth.checkStaticPermission( s, PagePermission.MODIFY ) );
- Assert.assertFalse( "Admin upload", m_auth.checkStaticPermission( s, PagePermission.UPLOAD ) );
- Assert.assertFalse( "Admin rename", m_auth.checkStaticPermission( s, PagePermission.RENAME ) );
- Assert.assertFalse( "Admin delete", m_auth.checkStaticPermission( s, PagePermission.DELETE ) );
- Assert.assertFalse( "Admin prefs", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ) );
- Assert.assertFalse( "Admin profile", m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ) );
- Assert.assertFalse( "Admin pages", m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ) );
- Assert.assertFalse( "Admin groups", m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ) );
+ Assertions.assertTrue( m_auth.checkStaticPermission( s, PagePermission.VIEW ), "Admin view" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.EDIT ), "Admin edit" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.COMMENT ), "Admin comment" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.MODIFY ), "Admin modify" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.UPLOAD ), "Admin upload" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.RENAME ), "Admin rename" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, PagePermission.DELETE ), "Admin delete" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PREFERENCES ), "Admin prefs" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.EDIT_PROFILE ), "Admin profile" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_PAGES ), "Admin pages" );
+ Assertions.assertFalse( m_auth.checkStaticPermission( s, WikiPermission.CREATE_GROUPS ), "Admin groups" );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/GroupManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/GroupManagerTest.java
index b82fd3c..9152784 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/GroupManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/GroupManagerTest.java
@@ -28,10 +28,10 @@ import org.apache.wiki.api.exceptions.WikiException;
import org.apache.wiki.auth.authorize.Group;
import org.apache.wiki.auth.authorize.GroupManager;
import org.apache.wiki.event.WikiSecurityEvent;
-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;
public class GroupManagerTest
{
@@ -43,7 +43,7 @@ public class GroupManagerTest
private WikiSession m_session;
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -52,7 +52,7 @@ public class GroupManagerTest
m_groupMgr = m_engine.getGroupManager();
m_session = WikiSessionTest.adminSession( m_engine );
- // Flush any pre-existing groups (left over from previous Assert.failures, perhaps)
+ // Flush any pre-existing groups (left over from previous Assertions.failures, perhaps)
try
{
m_groupMgr.removeGroup( "Test" );
@@ -77,11 +77,11 @@ public class GroupManagerTest
m_groupMgr.setGroup( m_session, group );
// We should see 3 events: 1 for each group add
- Assert.assertEquals( 3, m_trap.events().length );
+ Assertions.assertEquals( 3, m_trap.events().length );
m_trap.clearEvents();
}
- @After
+ @AfterEach
public void tearDown() throws WikiException
{
m_groupMgr.removeGroup( "Test" );
@@ -94,24 +94,24 @@ public class GroupManagerTest
{
String members = "Biff";
Group group = m_groupMgr.parseGroup( "Group1", members, true );
- Assert.assertEquals( 1, group.members().length );
- Assert.assertTrue ( group.isMember( new WikiPrincipal( "Biff" ) ) );
+ Assertions.assertEquals( 1, group.members().length );
+ Assertions.assertTrue ( group.isMember( new WikiPrincipal( "Biff" ) ) );
members = "Biff \n SteveAustin \n FredFlintstone";
group = m_groupMgr.parseGroup( "Group2", members, true );
- Assert.assertEquals( 3, group.members().length );
- Assert.assertTrue ( group.isMember( new WikiPrincipal( "Biff" ) ) );
- Assert.assertTrue ( group.isMember( new WikiPrincipal( "SteveAustin" ) ) );
- Assert.assertTrue ( group.isMember( new WikiPrincipal( "FredFlintstone" ) ) );
+ Assertions.assertEquals( 3, group.members().length );
+ Assertions.assertTrue ( group.isMember( new WikiPrincipal( "Biff" ) ) );
+ Assertions.assertTrue ( group.isMember( new WikiPrincipal( "SteveAustin" ) ) );
+ Assertions.assertTrue ( group.isMember( new WikiPrincipal( "FredFlintstone" ) ) );
}
@Test
public void testGetRoles()
{
Principal[] roles = m_groupMgr.getRoles();
- Assert.assertTrue( "Found Test", ArrayUtils.contains( roles, new GroupPrincipal( "Test" ) ) );
- Assert.assertTrue( "Found Test2", ArrayUtils.contains( roles, new GroupPrincipal( "Test2" ) ) );
- Assert.assertTrue( "Found Test3", ArrayUtils.contains( roles, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( roles, new GroupPrincipal( "Test" ) ), "Found Test" );
+ Assertions.assertTrue( ArrayUtils.contains( roles, new GroupPrincipal( "Test2" ) ), "Found Test2" );
+ Assertions.assertTrue( ArrayUtils.contains( roles, new GroupPrincipal( "Test3" ) ), "Found Test3" );
}
@Test
@@ -121,58 +121,58 @@ public class GroupManagerTest
// Anonymous; should belong to NO groups
s = WikiSessionTest.anonymousSession( m_engine );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
// Alice is asserted; should belong to NO groups
s = WikiSessionTest.assertedSession( m_engine, Users.ALICE );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
// Alice is authenticated; should belong to Test
s = WikiSessionTest.authenticatedSession( m_engine, Users.ALICE, Users.ALICE_PASS );
- Assert.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
+ Assertions.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
// Bob is authenticated; should belong to Test & Test2
s = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
- Assert.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
- Assert.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
+ Assertions.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
+ Assertions.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
// Charlie is authenticated; should belong to Test
s = WikiSessionTest.authenticatedSession( m_engine, Users.CHARLIE, Users.CHARLIE_PASS );
- Assert.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
+ Assertions.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
// Fred is authenticated; should belong to Test3
s = WikiSessionTest.authenticatedSession( m_engine, Users.FRED, Users.FRED_PASS );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
- Assert.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
+ Assertions.assertTrue( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
// Nobody loves Biff!
s = WikiSessionTest.authenticatedSession( m_engine, Users.BIFF, Users.BIFF_PASS );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
- Assert.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test2" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "Test3" ) ) );
+ Assertions.assertFalse( m_groupMgr.isUserInRole( s, new GroupPrincipal( "NonExistant" ) ) );
}
@Test
public void testGroupAddEvents() throws Exception
{
- // Flush any pre-existing groups (left over from previous Assert.failures, perhaps)
+ // Flush any pre-existing groups (left over from previous Assertions.failures, perhaps)
try
{
m_groupMgr.removeGroup( "Events" );
@@ -193,11 +193,11 @@ public class GroupManagerTest
// We should see a GROUP_ADD event
WikiSecurityEvent[] events = m_trap.events();
- Assert.assertEquals( 1, events.length );
+ Assertions.assertEquals( 1, events.length );
event = events[0];
- Assert.assertEquals( m_groupMgr, event.getSrc() );
- Assert.assertEquals( WikiSecurityEvent.GROUP_ADD, event.getType() );
- Assert.assertEquals( group, event.getTarget() );
+ Assertions.assertEquals( m_groupMgr, event.getSrc() );
+ Assertions.assertEquals( WikiSecurityEvent.GROUP_ADD, event.getType() );
+ Assertions.assertEquals( group, event.getTarget() );
// Clean up
m_groupMgr.removeGroup( "Events" );
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/UserManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/UserManagerTest.java
index afc8813..7b35001 100755
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/UserManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/UserManagerTest.java
@@ -41,10 +41,10 @@ import org.apache.wiki.workflow.DecisionQueue;
import org.apache.wiki.workflow.DecisionRequiredException;
import org.apache.wiki.workflow.Fact;
import org.apache.wiki.workflow.Outcome;
-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;
/**
*/
@@ -58,7 +58,7 @@ public class UserManagerTest {
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
@@ -73,7 +73,7 @@ public class UserManagerTest {
m_groupName = "Group" + System.currentTimeMillis();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
GroupManager groupManager = m_engine.getGroupManager();
if( groupManager.findRole( m_groupName ) != null ) {
@@ -121,22 +121,22 @@ public class UserManagerTest {
// 1a. Make sure the profile saved successfully and that we're logged in
profile = m_mgr.getUserProfile( session );
- Assert.assertEquals( oldLogin, profile.getLoginName() );
- Assert.assertEquals( oldName, profile.getFullname() );
- Assert.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
- Assert.assertTrue( session.isAuthenticated() );
+ Assertions.assertEquals( oldLogin, profile.getLoginName() );
+ Assertions.assertEquals( oldName, profile.getFullname() );
+ Assertions.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
+ Assertions.assertTrue( session.isAuthenticated() );
// Setup Step 2: create a new group with our test user in it
Group group = groupManager.parseGroup( m_groupName, "Alice \n Bob \n Charlie \n " + oldLogin + "\n" + oldName, true );
groupManager.setGroup( session, group );
// 2a. Make sure the group is created with the user in it, and the role is added to the Subject
- Assert.assertEquals( oldGroupCount + 1, groupManager.getRoles().length );
- Assert.assertTrue( group.isMember( new WikiPrincipal( oldLogin ) ) );
- Assert.assertTrue( group.isMember( new WikiPrincipal( oldName ) ) );
- Assert.assertFalse( group.isMember( new WikiPrincipal( newLogin ) ) );
- Assert.assertFalse( group.isMember( new WikiPrincipal( newName ) ) );
- Assert.assertTrue( groupManager.isUserInRole( session, group.getPrincipal() ) );
+ Assertions.assertEquals( oldGroupCount + 1, groupManager.getRoles().length );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( oldName ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( newLogin ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( newName ) ) );
+ Assertions.assertTrue( groupManager.isUserInRole( session, group.getPrincipal() ) );
// Setup Step 3: create a new page with our test user in the ACL
String pageName = "TestPage" + now;
@@ -144,14 +144,14 @@ public class UserManagerTest {
// 3a. Make sure the page got saved, and that ONLY our test user has permission to read it.
WikiPage p = m_engine.getPage( pageName );
- Assert.assertEquals( oldPageCount + 1, pageManager.getTotalPageCount() );
- Assert.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
- Assert.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
- Assert.assertTrue( "Test User view page", authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ) );
+ Assertions.assertEquals( oldPageCount + 1, pageManager.getTotalPageCount() );
+ Assertions.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
+ Assertions.assertTrue( authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ), "Test User view page" );
WikiSession bobSession = WikiSessionTest.authenticatedSession( m_engine, Users.BOB, Users.BOB_PASS );
- Assert.assertFalse( "Bob !view page", authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ) );
+ Assertions.assertFalse( authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ), "Bob !view page" );
// Setup Step 4: change the user name in the profile and see what happens
profile = m_db.newProfile();
@@ -163,34 +163,34 @@ public class UserManagerTest {
// Test 1: the wiki session should have the new wiki name in Subject
Principal[] principals = session.getPrincipals();
- Assert.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( oldLogin ) ) );
- Assert.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( oldName ) ) );
- Assert.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( newLogin ) ) );
- Assert.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( newName ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( oldName ) ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( newLogin ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( newName ) ) );
// Test 2: our group should not contain the old name OR login name any more
// (the full name is always used)
group = groupManager.getGroup( m_groupName );
- Assert.assertFalse( group.isMember( new WikiPrincipal( oldLogin ) ) );
- Assert.assertFalse( group.isMember( new WikiPrincipal( oldName ) ) );
- Assert.assertFalse( group.isMember( new WikiPrincipal( newLogin ) ) );
- Assert.assertTrue( group.isMember( new WikiPrincipal( newName ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( oldName ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( newLogin ) ) );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( newName ) ) );
// Test 3: our page should not contain the old wiki name OR login name
// in the ACL any more (the full name is always used)
p = m_engine.getPage( pageName );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
- Assert.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
- Assert.assertTrue( "Test User view page", authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ) );
- Assert.assertFalse( "Bob !view page", authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
+ Assertions.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
+ Assertions.assertTrue( authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ), "Test User view page" );
+ Assertions.assertFalse( authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ), "Bob !view page" );
// Test 4: our page text should have been re-written
// (The new full name should be in the ACL, but the login name should have been removed)
String expectedText = "[{ALLOW view Alice," + newName + "}]\nTest text. More text.\r\n";
String actualText = m_engine.getText( pageName );
- Assert.assertEquals( expectedText, actualText );
+ Assertions.assertEquals( expectedText, actualText );
// Remove our test page
m_engine.deletePage( pageName );
@@ -204,13 +204,13 @@ public class UserManagerTest {
pageName = "TestPage2" + now;
m_engine.saveText( pageName, "More test text. [{ALLOW view " + oldName + ", " + oldLogin + ", Alice}] More text." );
p = m_engine.getPage( pageName );
- Assert.assertEquals( oldPageCount + 1, pageManager.getTotalPageCount() );
- Assert.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
- Assert.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
- Assert.assertTrue( "Test User view page", authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ) );
- Assert.assertFalse( "Bob !view page", authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ) );
+ Assertions.assertEquals( oldPageCount + 1, pageManager.getTotalPageCount() );
+ Assertions.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
+ Assertions.assertTrue( authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ), "Test User view page" );
+ Assertions.assertFalse( authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ), "Bob !view page" );
// Setup Step 8: re-save the profile with the new login name
profile = m_db.newProfile();
@@ -222,44 +222,44 @@ public class UserManagerTest {
// Test 5: the wiki session should have the new login name in Subject
principals = session.getPrincipals();
- Assert.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( oldLogin ) ) );
- Assert.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( oldName ) ) );
- Assert.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( newLogin ) ) );
- Assert.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( newName ) ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( oldName ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( principals, new WikiPrincipal( newLogin ) ) );
+ Assertions.assertFalse( ArrayUtils.contains( principals, new WikiPrincipal( newName ) ) );
// Test 6: our group should not contain the old name OR login name any more
// (the full name is always used)
group = groupManager.getGroup( m_groupName );
- Assert.assertFalse( group.isMember( new WikiPrincipal( oldLogin ) ) );
- Assert.assertTrue( group.isMember( new WikiPrincipal( oldName ) ) );
- Assert.assertFalse( group.isMember( new WikiPrincipal( newLogin ) ) );
- Assert.assertFalse( group.isMember( new WikiPrincipal( newName ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( oldName ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( newLogin ) ) );
+ Assertions.assertFalse( group.isMember( new WikiPrincipal( newName ) ) );
// Test 7: our page should not contain the old wiki name OR login name
// in the ACL any more (the full name is always used)
p = m_engine.getPage( pageName );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
- Assert.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
- Assert.assertNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
- Assert.assertTrue( "Test User view page", authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ) );
- Assert.assertFalse( "Bob !view page", authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( oldLogin ) ) );
+ Assertions.assertNotNull( p.getAcl().getEntry( new WikiPrincipal( oldName ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newLogin ) ) );
+ Assertions.assertNull( p.getAcl().getEntry( new WikiPrincipal( newName ) ) );
+ Assertions.assertTrue( authManager.checkPermission( session, PermissionFactory.getPagePermission( p, "view" ) ), "Test User view page" );
+ Assertions.assertFalse( authManager.checkPermission( bobSession, PermissionFactory.getPagePermission( p, "view" ) ), "Bob !view page" );
// Test 8: our page text should have been re-written
// (The new full name should be in the ACL, but the login name should have been removed)
expectedText = "[{ALLOW view Alice," + oldName + "}]\nMore test text. More text.\r\n";
actualText = m_engine.getText( pageName );
- Assert.assertEquals( expectedText, actualText );
+ Assertions.assertEquals( expectedText, actualText );
// CLEANUP: delete the profile; user and page; should be back to old counts
m_db.deleteByLoginName( newLogin );
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
groupManager.removeGroup( group.getName() );
- Assert.assertEquals( oldGroupCount, groupManager.getRoles().length );
+ Assertions.assertEquals( oldGroupCount, groupManager.getRoles().length );
m_engine.deletePage( pageName );
- Assert.assertEquals( oldPageCount, pageManager.getTotalPageCount() );
+ Assertions.assertEquals( oldPageCount, pageManager.getTotalPageCount() );
}
@Test
@@ -279,12 +279,12 @@ public class UserManagerTest {
// Make sure the profile saved successfully
profile = m_mgr.getUserProfile( session );
- Assert.assertEquals( loginName, profile.getLoginName() );
- Assert.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
+ Assertions.assertEquals( loginName, profile.getLoginName() );
+ Assertions.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
// Now delete the profile; should be back to old count
m_db.deleteByLoginName( loginName );
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
}
@Test
@@ -306,36 +306,36 @@ public class UserManagerTest {
// Because user profile saves require approvals, we will catch a Redirect
try {
m_mgr.setUserProfile( session, profile );
- Assert.fail( "We should have caught a DecisionRequiredException caused by approval!" );
+ Assertions.fail( "We should have caught a DecisionRequiredException caused by approval!" );
} catch( DecisionRequiredException e ) {
}
// The user should NOT be saved yet
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
// Now, look in Admin's queue, and verify there's a pending Decision there
DecisionQueue dq = m_engine.getWorkflowManager().getDecisionQueue();
Collection decisions = dq.getActorDecisions( m_engine.adminSession() );
- Assert.assertEquals( 1, decisions.size() );
+ Assertions.assertEquals( 1, decisions.size() );
// Verify that the Decision has all the facts and attributes we need
Decision d = ( Decision )decisions.iterator().next();
List facts = d.getFacts();
- Assert.assertEquals( new Fact( UserManager.PREFS_FULL_NAME, profile.getFullname() ), facts.get( 0 ) );
- Assert.assertEquals( new Fact( UserManager.PREFS_LOGIN_NAME, profile.getLoginName() ), facts.get( 1 ) );
- Assert.assertEquals( new Fact( UserManager.FACT_SUBMITTER, session.getUserPrincipal().getName() ), facts.get( 2 ) );
- Assert.assertEquals( new Fact( UserManager.PREFS_EMAIL, profile.getEmail() ), facts.get( 3 ) );
- Assert.assertEquals( profile, d.getWorkflow().getAttribute( UserManager.SAVED_PROFILE ) );
+ Assertions.assertEquals( new Fact( UserManager.PREFS_FULL_NAME, profile.getFullname() ), facts.get( 0 ) );
+ Assertions.assertEquals( new Fact( UserManager.PREFS_LOGIN_NAME, profile.getLoginName() ), facts.get( 1 ) );
+ Assertions.assertEquals( new Fact( UserManager.FACT_SUBMITTER, session.getUserPrincipal().getName() ), facts.get( 2 ) );
+ Assertions.assertEquals( new Fact( UserManager.PREFS_EMAIL, profile.getEmail() ), facts.get( 3 ) );
+ Assertions.assertEquals( profile, d.getWorkflow().getAttribute( UserManager.SAVED_PROFILE ) );
// Approve the profile
d.decide( Outcome.DECISION_APPROVE );
// Make sure the profile saved successfully
- Assert.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
// Now delete the profile; should be back to old count
m_db.deleteByLoginName( loginName );
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
}
@Test
@@ -357,32 +357,32 @@ public class UserManagerTest {
// Because user profile saves require approvals, we will catch a Redirect
try {
m_mgr.setUserProfile( session, profile );
- Assert.fail( "We should have caught a DecisionRequiredException caused by approval!" );
+ Assertions.fail( "We should have caught a DecisionRequiredException caused by approval!" );
} catch( DecisionRequiredException e ) {
}
// The user should NOT be saved yet
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
// Now, look in Admin's queue, and verify there's a pending Decision there
DecisionQueue dq = m_engine.getWorkflowManager().getDecisionQueue();
Collection decisions = dq.getActorDecisions( m_engine.adminSession() );
- Assert.assertEquals( 1, decisions.size() );
+ Assertions.assertEquals( 1, decisions.size() );
// Verify that the Decision has all the facts and attributes we need
Decision d = ( Decision )decisions.iterator().next();
List facts = d.getFacts();
- Assert.assertEquals( new Fact( UserManager.PREFS_FULL_NAME, profile.getFullname() ), facts.get( 0 ) );
- Assert.assertEquals( new Fact( UserManager.PREFS_LOGIN_NAME, profile.getLoginName() ), facts.get( 1 ) );
- Assert.assertEquals( new Fact( UserManager.FACT_SUBMITTER, session.getUserPrincipal().getName() ), facts.get( 2 ) );
- Assert.assertEquals( new Fact( UserManager.PREFS_EMAIL, profile.getEmail() ), facts.get( 3 ) );
- Assert.assertEquals( profile, d.getWorkflow().getAttribute( UserManager.SAVED_PROFILE ) );
+ Assertions.assertEquals( new Fact( UserManager.PREFS_FULL_NAME, profile.getFullname() ), facts.get( 0 ) );
+ Assertions.assertEquals( new Fact( UserManager.PREFS_LOGIN_NAME, profile.getLoginName() ), facts.get( 1 ) );
+ Assertions.assertEquals( new Fact( UserManager.FACT_SUBMITTER, session.getUserPrincipal().getName() ), facts.get( 2 ) );
+ Assertions.assertEquals( new Fact( UserManager.PREFS_EMAIL, profile.getEmail() ), facts.get( 3 ) );
+ Assertions.assertEquals( profile, d.getWorkflow().getAttribute( UserManager.SAVED_PROFILE ) );
// Approve the profile
d.decide( Outcome.DECISION_DENY );
// Make sure the profile did NOT save
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
}
@Test
@@ -403,7 +403,7 @@ public class UserManagerTest {
profile.setLoginName( "janne" );
try {
m_mgr.setUserProfile( session, profile );
- Assert.fail( "UserManager allowed saving of user with login name 'janne', but it shouldn't have." );
+ Assertions.fail( "UserManager allowed saving of user with login name 'janne', but it shouldn't have." );
} catch( DuplicateUserException e ) {
// Good! That's what we expected; reset for next test
profile.setLoginName( loginName );
@@ -413,13 +413,13 @@ public class UserManagerTest {
profile.setFullname( "Janne Jalkanen" );
try {
m_mgr.setUserProfile( session, profile );
- Assert.fail( "UserManager allowed saving of user with login name 'janne', but it shouldn't have." );
+ Assertions.fail( "UserManager allowed saving of user with login name 'janne', but it shouldn't have." );
} catch( DuplicateUserException e ) {
// Good! That's what we expected
}
// There shouldn't have been any users added
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclEntryImplTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclEntryImplTest.java
index 31f5ca0..40e0505 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclEntryImplTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclEntryImplTest.java
@@ -19,16 +19,16 @@
package org.apache.wiki.auth.acl;
import org.apache.wiki.auth.permissions.PagePermission;
import org.apache.wiki.auth.permissions.PermissionFactory;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class AclEntryImplTest
{
AclEntryImpl m_ae;
- @Before
+ @BeforeEach
public void setUp()
{
m_ae = new AclEntryImpl();
@@ -39,8 +39,8 @@ public class AclEntryImplTest
{
m_ae.addPermission( PagePermission.VIEW );
- Assert.assertTrue( "no permission", m_ae.checkPermission( PagePermission.VIEW ) );
- Assert.assertFalse( "permission found", m_ae.checkPermission( PagePermission.EDIT ) );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.VIEW ), "no permission" );
+ Assertions.assertFalse( m_ae.checkPermission( PagePermission.EDIT ), "permission found" );
}
@Test
@@ -49,8 +49,8 @@ public class AclEntryImplTest
m_ae.addPermission( PagePermission.VIEW );
m_ae.addPermission( PagePermission.EDIT );
- Assert.assertTrue( "no editpermission", m_ae.checkPermission( PagePermission.EDIT ) );
- Assert.assertTrue( "no viewpermission", m_ae.checkPermission( PagePermission.VIEW ) );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.EDIT ), "no editpermission" );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.VIEW ), "no viewpermission" );
}
@Test
@@ -58,7 +58,7 @@ public class AclEntryImplTest
{
m_ae.addPermission( PagePermission.COMMENT );
- Assert.assertFalse( "has edit permission", m_ae.checkPermission( PagePermission.EDIT ) );
+ Assertions.assertFalse( m_ae.checkPermission( PagePermission.EDIT ), "has edit permission" );
}
@Test
@@ -66,7 +66,7 @@ public class AclEntryImplTest
{
m_ae.addPermission( PagePermission.EDIT );
- Assert.assertTrue( "has comment permission", m_ae.checkPermission( PagePermission.COMMENT ) );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.COMMENT ), "has comment permission" );
}
@Test
@@ -74,8 +74,8 @@ public class AclEntryImplTest
{
m_ae.addPermission( PagePermission.VIEW );
- Assert.assertTrue( "has view all", m_ae.checkPermission( PagePermission.VIEW ) );
- Assert.assertTrue( "has view on single page", m_ae.checkPermission( PermissionFactory.getPagePermission( "mywiki:SamplePage", "view" ) ) );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.VIEW ), "has view all" );
+ Assertions.assertTrue( m_ae.checkPermission( PermissionFactory.getPagePermission( "mywiki:SamplePage", "view" ) ), "has view on single page" );
}
@Test
@@ -84,20 +84,20 @@ public class AclEntryImplTest
m_ae.addPermission( PagePermission.VIEW );
m_ae.addPermission( PagePermission.EDIT );
- Assert.assertTrue( "has edit permission", m_ae.checkPermission( PagePermission.EDIT ) );
- Assert.assertTrue( "has view permission", m_ae.checkPermission( PagePermission.VIEW ) );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.EDIT ), "has edit permission" );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.VIEW ), "has view permission" );
m_ae.removePermission( PagePermission.EDIT );
- Assert.assertFalse( "no edit permission", m_ae.checkPermission( PagePermission.EDIT ) );
- Assert.assertTrue( "has view permission", m_ae.checkPermission( PagePermission.VIEW ) );
+ Assertions.assertFalse( m_ae.checkPermission( PagePermission.EDIT ), "no edit permission" );
+ Assertions.assertTrue( m_ae.checkPermission( PagePermission.VIEW ), "has view permission" );
}
@Test
public void testDefaults()
{
- Assert.assertFalse( "elements", m_ae.permissions().hasMoreElements() );
- Assert.assertNull( "principal", m_ae.getPrincipal() );
+ Assertions.assertFalse( m_ae.permissions().hasMoreElements(), "elements" );
+ Assertions.assertNull( m_ae.getPrincipal(), "principal" );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java
index baf14f4..c9cfebc 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/AclImplTest.java
@@ -35,10 +35,10 @@ import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.authorize.Group;
import org.apache.wiki.auth.authorize.GroupManager;
import org.apache.wiki.auth.permissions.PagePermission;
-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;
public class AclImplTest
{
@@ -57,7 +57,7 @@ public class AclImplTest
* Charlie = may view Dave = may view, may comment groupAcl: FooGroup =
* Alice, Bob - may edit BarGroup = Bob, Charlie - may view
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
@@ -125,7 +125,7 @@ public class AclImplTest
m_groups.put( "BarGroup", bar );
}
- @After
+ @AfterEach
public void tearDown() throws Exception
{
m_groupMgr.removeGroup( "FooGroup" );
@@ -166,9 +166,9 @@ public class AclImplTest
{
// Alice should be able to view but not edit or comment
Principal wup = new WikiPrincipal( "Alice" );
- Assert.assertTrue( "view", inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertFalse( "edit", inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertFalse( "comment", inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
+ Assertions.assertTrue( inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
}
@Test
@@ -176,10 +176,10 @@ public class AclImplTest
{
// Bob should be able to view, edit, and comment but not delete
Principal wup = new WikiPrincipal( "Bob" );
- Assert.assertTrue( "view", inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertTrue( "edit", inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertTrue( "comment", inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
- Assert.assertFalse( "delete", inArray( m_acl.findPrincipals( PagePermission.DELETE ), wup ) );
+ Assertions.assertTrue( inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
+ Assertions.assertTrue( inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
+ Assertions.assertTrue( inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.DELETE ), wup ) );
}
@Test
@@ -187,10 +187,10 @@ public class AclImplTest
{
// Charlie should be able to view, but not edit, comment or delete
Principal wup = new WikiPrincipal( "Charlie" );
- Assert.assertTrue( "view", inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertFalse( "edit", inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertFalse( "comment", inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
- Assert.assertFalse( "delete", inArray( m_acl.findPrincipals( PagePermission.DELETE ), wup ) );
+ Assertions.assertTrue( inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.DELETE ), wup ) );
}
@Test
@@ -198,38 +198,38 @@ public class AclImplTest
{
// Dave should be able to view and comment but not edit or delete
Principal wup = new WikiPrincipal( "Dave" );
- Assert.assertTrue( "view", inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertFalse( "edit", inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertTrue( "comment", inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
- Assert.assertFalse( "delete", inArray( m_acl.findPrincipals( PagePermission.DELETE ), wup ) );
+ Assertions.assertTrue( inArray( m_acl.findPrincipals( PagePermission.VIEW ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.EDIT ), wup ) );
+ Assertions.assertTrue( inArray( m_acl.findPrincipals( PagePermission.COMMENT ), wup ) );
+ Assertions.assertFalse( inArray( m_acl.findPrincipals( PagePermission.DELETE ), wup ) );
}
@Test
public void testGroups()
{
Principal wup = new WikiPrincipal( "Alice" );
- Assert.assertTrue( "Alice view", inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertTrue( "Alice edit", inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertTrue( "Alice comment", inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ) );
- Assert.assertFalse( "Alice delete", inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ) );
+ Assertions.assertTrue( inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ), "Alice view" );
+ Assertions.assertTrue( inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ), "Alice edit" );
+ Assertions.assertTrue( inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ), "Alice comment" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ),"Alice delete" );
wup = new WikiPrincipal( "Bob" );
- Assert.assertTrue( "Bob view", inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertTrue( "Bob edit", inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertTrue( "Bob comment", inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ) );
- Assert.assertFalse( "Bob delete", inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ) );
+ Assertions.assertTrue( inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ), "Bob view" );
+ Assertions.assertTrue( inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ), "Bob edit" );
+ Assertions.assertTrue( inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ), "Bob comment" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ), "Bob delete" );
wup = new WikiPrincipal( "Charlie" );
- Assert.assertTrue( "Charlie view", inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertFalse( "Charlie edit", inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertFalse( "Charlie comment", inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ) );
- Assert.assertFalse( "Charlie delete", inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ) );
+ Assertions.assertTrue( inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ), "Charlie view" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ), "Charlie edit" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ), "Charlie comment" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ),"Charlie delete" );
wup = new WikiPrincipal( "Dave" );
- Assert.assertFalse( "Dave view", inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ) );
- Assert.assertFalse( "Dave edit", inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ) );
- Assert.assertFalse( "Dave comment", inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ) );
- Assert.assertFalse( "Dave delete", inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ) );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.VIEW ), wup ), "Dave view" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.EDIT ), wup ), "Dave edit" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.COMMENT ), wup ), "Dave comment" );
+ Assertions.assertFalse( inGroup( m_aclGroup.findPrincipals( PagePermission.DELETE ), wup ), "Dave delete" );
}
@Test
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java
index 49b32df..0cb82e1 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/acl/DefaultAclManagerTest.java
@@ -27,16 +27,16 @@ import org.apache.wiki.WikiPage;
import org.apache.wiki.api.exceptions.ProviderException;
import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.permissions.PermissionFactory;
-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;
public class DefaultAclManagerTest
{
TestEngine m_engine;
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -50,7 +50,7 @@ public class DefaultAclManagerTest
m_engine.saveText( "TestAclPage", text );
}
- @After
+ @AfterEach
public void tearDown()
{
try
@@ -68,43 +68,43 @@ public class DefaultAclManagerTest
{
WikiPage page = m_engine.getPage( "TestDefaultPage" );
Acl acl = m_engine.getAclManager().getPermissions( page );
- Assert.assertNotNull( page.getAcl() );
- Assert.assertTrue(page.getAcl().isEmpty());
+ Assertions.assertNotNull( page.getAcl() );
+ Assertions.assertTrue(page.getAcl().isEmpty());
page = m_engine.getPage( "TestAclPage" );
acl = m_engine.getAclManager().getPermissions( page );
- Assert.assertNotNull( page.getAcl() );
- Assert.assertFalse(page.getAcl().isEmpty());
+ Assertions.assertNotNull( page.getAcl() );
+ Assertions.assertFalse(page.getAcl().isEmpty());
Principal[] p;
// Charlie is an editor; reading is therefore implied
p = acl.findPrincipals( PermissionFactory.getPagePermission(page, "view") );
- Assert.assertEquals( 2, p.length );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal("Charlie") ) );
+ Assertions.assertEquals( 2, p.length );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal("Charlie") ) );
// Charlie should be in the ACL as an editor
p = acl.findPrincipals( PermissionFactory.getPagePermission(page, "edit") );
- Assert.assertEquals( 2, p.length );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal("Charlie") ) );
+ Assertions.assertEquals( 2, p.length );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal("Charlie") ) );
// Charlie should not be able to delete this page
p = acl.findPrincipals( PermissionFactory.getPagePermission(page, "delete") );
- Assert.assertEquals( 0, p.length );
+ Assertions.assertEquals( 0, p.length );
// Herman is an unregistered user and editor; reading is implied
p = acl.findPrincipals( PermissionFactory.getPagePermission(page, "view") );
- Assert.assertEquals( 2, p.length );
- Assert.assertTrue( ArrayUtils.contains( p, new UnresolvedPrincipal("Herman") ) );
+ Assertions.assertEquals( 2, p.length );
+ Assertions.assertTrue( ArrayUtils.contains( p, new UnresolvedPrincipal("Herman") ) );
// Herman should be in the ACL as an editor
p = acl.findPrincipals( PermissionFactory.getPagePermission(page, "edit") );
- Assert.assertEquals( 2, p.length );
- Assert.assertTrue( ArrayUtils.contains( p, new UnresolvedPrincipal("Herman") ) );
+ Assertions.assertEquals( 2, p.length );
+ Assertions.assertTrue( ArrayUtils.contains( p, new UnresolvedPrincipal("Herman") ) );
// Herman should not be able to delete this page
p = acl.findPrincipals( PermissionFactory.getPagePermission(page, "delete") );
- Assert.assertEquals( 0, p.length );
+ Assertions.assertEquals( 0, p.length );
}
@Test
@@ -115,57 +115,57 @@ public class DefaultAclManagerTest
acl = "[{ALLOW view Bob, Alice, Betty}] Test text.";
m = DefaultAclManager.ACL_PATTERN.matcher( acl );
- Assert.assertTrue ( m.find() );
- Assert.assertEquals( 2, m.groupCount() );
- Assert.assertEquals( "[{ALLOW view Bob, Alice, Betty}]", m.group(0) );
- Assert.assertEquals( "view", m.group(1) );
- Assert.assertEquals( "Bob, Alice, Betty", m.group(2) );
- Assert.assertFalse( m.find() );
+ Assertions.assertTrue ( m.find() );
+ Assertions.assertEquals( 2, m.groupCount() );
+ Assertions.assertEquals( "[{ALLOW view Bob, Alice, Betty}]", m.group(0) );
+ Assertions.assertEquals( "view", m.group(1) );
+ Assertions.assertEquals( "Bob, Alice, Betty", m.group(2) );
+ Assertions.assertFalse( m.find() );
acl = "[{ALLOW view Alice}] Test text.";
m = DefaultAclManager.ACL_PATTERN.matcher( acl );
- Assert.assertTrue ( m.find() );
+ Assertions.assertTrue ( m.find() );
// System.out.println( m.group() );
- Assert.assertEquals( 2, m.groupCount() );
- Assert.assertEquals( "[{ALLOW view Alice}]", m.group(0) );
- Assert.assertEquals( "view", m.group(1) );
- Assert.assertEquals( "Alice", m.group(2) );
- Assert.assertFalse( m.find() );
+ Assertions.assertEquals( 2, m.groupCount() );
+ Assertions.assertEquals( "[{ALLOW view Alice}]", m.group(0) );
+ Assertions.assertEquals( "view", m.group(1) );
+ Assertions.assertEquals( "Alice", m.group(2) );
+ Assertions.assertFalse( m.find() );
acl = "Test text [{ ALLOW view Alice }] Test text.";
m = DefaultAclManager.ACL_PATTERN.matcher( acl );
- Assert.assertTrue ( m.find() );
+ Assertions.assertTrue ( m.find() );
// System.out.println( m.group() );
- Assert.assertEquals( 2, m.groupCount() );
- Assert.assertEquals( "[{ ALLOW view Alice }]", m.group(0) );
- Assert.assertEquals( "view", m.group(1) );
- Assert.assertEquals( "Alice", m.group(2) );
- Assert.assertFalse( m.find() );
+ Assertions.assertEquals( 2, m.groupCount() );
+ Assertions.assertEquals( "[{ ALLOW view Alice }]", m.group(0) );
+ Assertions.assertEquals( "view", m.group(1) );
+ Assertions.assertEquals( "Alice", m.group(2) );
+ Assertions.assertFalse( m.find() );
acl = "Test text [{ ALLOW view Alice , Bob }] Test text.";
m = DefaultAclManager.ACL_PATTERN.matcher( acl );
- Assert.assertTrue ( m.find() );
+ Assertions.assertTrue ( m.find() );
// System.out.println( m.group() );
- Assert.assertEquals( 2, m.groupCount() );
- Assert.assertEquals( "[{ ALLOW view Alice , Bob }]", m.group(0) );
- Assert.assertEquals( "view", m.group(1) );
- Assert.assertEquals( "Alice , Bob", m.group(2) );
- Assert.assertFalse( m.find() );
+ Assertions.assertEquals( 2, m.groupCount() );
+ Assertions.assertEquals( "[{ ALLOW view Alice , Bob }]", m.group(0) );
+ Assertions.assertEquals( "view", m.group(1) );
+ Assertions.assertEquals( "Alice , Bob", m.group(2) );
+ Assertions.assertFalse( m.find() );
acl = "Test text [{ ALLOW view Alice , Bob }] Test text [{ALLOW edit Betty}].";
m = DefaultAclManager.ACL_PATTERN.matcher( acl );
- Assert.assertTrue ( m.find() );
+ Assertions.assertTrue ( m.find() );
// System.out.println( m.group() );
- Assert.assertEquals( 2, m.groupCount() );
- Assert.assertEquals( "[{ ALLOW view Alice , Bob }]", m.group(0) );
- Assert.assertEquals( "view", m.group(1) );
- Assert.assertEquals( "Alice , Bob", m.group(2) );
- Assert.assertTrue ( m.find() );
- Assert.assertEquals( 2, m.groupCount() );
- Assert.assertEquals( "[{ALLOW edit Betty}]", m.group(0) );
- Assert.assertEquals( "edit", m.group(1) );
- Assert.assertEquals( "Betty", m.group(2) );
- Assert.assertFalse( m.find() );
+ Assertions.assertEquals( 2, m.groupCount() );
+ Assertions.assertEquals( "[{ ALLOW view Alice , Bob }]", m.group(0) );
+ Assertions.assertEquals( "view", m.group(1) );
+ Assertions.assertEquals( "Alice , Bob", m.group(2) );
+ Assertions.assertTrue ( m.find() );
+ Assertions.assertEquals( 2, m.groupCount() );
+ Assertions.assertEquals( "[{ALLOW edit Betty}]", m.group(0) );
+ Assertions.assertEquals( "edit", m.group(1) );
+ Assertions.assertEquals( "Betty", m.group(2) );
+ Assertions.assertFalse( m.find() );
}
@Test
@@ -175,7 +175,7 @@ public class DefaultAclManagerTest
WikiPage page = m_engine.getPage( "TestAclPage" );
Acl acl = m_engine.getAclManager().getPermissions( page );
String aclString = DefaultAclManager.printAcl( acl );
- Assert.assertEquals( "[{ALLOW edit Charlie,Herman}]\n", aclString );
+ Assertions.assertEquals( "[{ALLOW edit Charlie,Herman}]\n", aclString );
// Create an ACL from scratch
acl = new AclImpl();
@@ -192,7 +192,7 @@ public class DefaultAclManagerTest
// Verify that the printed ACL is OK
String expectedValue = "[{ALLOW delete Devin}]\n[{ALLOW edit Charlie,Devin}]\n[{ALLOW view Charlie}]\n";
- Assert.assertEquals( expectedValue, DefaultAclManager.printAcl( acl ) );
+ Assertions.assertEquals( expectedValue, DefaultAclManager.printAcl( acl ) );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/GroupTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/GroupTest.java
index 0e49c20..c2b0722 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/GroupTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/GroupTest.java
@@ -23,16 +23,16 @@ import java.util.Properties;
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiEngine;
import org.apache.wiki.auth.WikiPrincipal;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class GroupTest
{
Group m_group;
String m_wiki;
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -47,7 +47,7 @@ public class GroupTest
{
Principal u1 = new WikiPrincipal( "Alice" );
m_group.add( u1 );
- Assert.assertTrue( m_group.isMember( u1 ) );
+ Assertions.assertTrue( m_group.isMember( u1 ) );
}
@Test
@@ -56,12 +56,12 @@ public class GroupTest
Principal u1 = new WikiPrincipal( "Alice" );
Principal u2 = new WikiPrincipal( "Bob" );
- Assert.assertTrue( "adding alice", m_group.add( u1 ) );
+ Assertions.assertTrue( m_group.add( u1 ), "adding alice" );
- Assert.assertTrue( "adding bob", m_group.add( u2 ) );
+ Assertions.assertTrue( m_group.add( u2 ), "adding bob" );
- Assert.assertTrue( "Alice", m_group.isMember( u1 ) );
- Assert.assertTrue( "Bob", m_group.isMember( u2 ) );
+ Assertions.assertTrue( m_group.isMember( u1 ), "Alice" );
+ Assertions.assertTrue( m_group.isMember( u2 ), "Bob" );
}
/**
@@ -74,11 +74,11 @@ public class GroupTest
Principal u2 = new WikiPrincipal( "Bob" );
Principal u3 = new WikiPrincipal( "Bob" );
- Assert.assertTrue( "adding alice", m_group.add( u1 ) );
- Assert.assertTrue( "adding bob", m_group.add( u2 ) );
+ Assertions.assertTrue( m_group.add( u1 ), "adding alice" );
+ Assertions.assertTrue( m_group.add( u2 ), "adding bob" );
- Assert.assertTrue( "Alice", m_group.isMember( u1 ) );
- Assert.assertTrue( "Bob", m_group.isMember( u3 ) );
+ Assertions.assertTrue( m_group.isMember( u1 ), "Alice" );
+ Assertions.assertTrue( m_group.isMember( u3 ), "Bob" );
}
@Test
@@ -93,9 +93,9 @@ public class GroupTest
m_group.remove( u3 );
- Assert.assertTrue( "Alice", m_group.isMember( u1 ) );
- Assert.assertFalse( "Bob", m_group.isMember( u2 ) );
- Assert.assertFalse( "Bob 2", m_group.isMember( u3 ) );
+ Assertions.assertTrue( m_group.isMember( u1 ), "Alice" );
+ Assertions.assertFalse( m_group.isMember( u2 ), "Bob" );
+ Assertions.assertFalse( m_group.isMember( u3 ), "Bob 2" );
}
@Test
@@ -114,7 +114,7 @@ public class GroupTest
group2.add( u3 );
group2.add( u4 );
- Assert.assertTrue( m_group.equals( group2 ) );
+ Assertions.assertTrue( m_group.equals( group2 ) );
}
@Test
@@ -133,7 +133,7 @@ public class GroupTest
group2.add( u3 );
group2.add( u4 );
- Assert.assertFalse( m_group.equals( group2 ) );
+ Assertions.assertFalse( m_group.equals( group2 ) );
}
@Test
@@ -151,7 +151,7 @@ public class GroupTest
group2.add( u3 );
group2.add( u4 );
- Assert.assertTrue( group1.equals( group2 ) );
+ Assertions.assertTrue( group1.equals( group2 ) );
}
@Test
@@ -169,7 +169,7 @@ public class GroupTest
group2.add( u3 );
group2.add( u4 );
- Assert.assertFalse( m_group.equals( group2 ) );
+ Assertions.assertFalse( m_group.equals( group2 ) );
}
}
\ No newline at end of file
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java
index b91a851..2ccbfad 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java
@@ -37,10 +37,10 @@ import org.apache.wiki.api.exceptions.WikiException;
import org.apache.wiki.auth.NoSuchPrincipalException;
import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.WikiSecurityException;
-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;
/**
*/
@@ -57,7 +57,7 @@ public class JDBCGroupDatabaseTest
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
m_hu.setUp();
@@ -88,7 +88,7 @@ public class JDBCGroupDatabaseTest
}
catch( SQLException e )
{
- Assert.fail("Looks like your database could not be connected to - "+
+ Assertions.fail("Looks like your database could not be connected to - "+
"please make sure that you have started your database, exception: " + e.getMessage());
}
@@ -97,7 +97,7 @@ public class JDBCGroupDatabaseTest
m_db.initialize( engine, new Properties() );
}
- @After
+ @AfterEach
public void tearDown() throws Exception
{
if ( m_conn != null )
@@ -124,12 +124,12 @@ public class JDBCGroupDatabaseTest
// Make sure the profile saved successfully
group = backendGroup( name );
- Assert.assertEquals( name, group.getName() );
- Assert.assertEquals( oldUserCount+1, m_db.groups().length );
+ Assertions.assertEquals( name, group.getName() );
+ Assertions.assertEquals( oldUserCount+1, m_db.groups().length );
// Now delete the profile; should be back to old count
m_db.delete( group );
- Assert.assertEquals( oldUserCount, m_db.groups().length );
+ Assertions.assertEquals( oldUserCount, m_db.groups().length );
}
@Test
@@ -137,41 +137,41 @@ public class JDBCGroupDatabaseTest
{
// Test file has 4 groups in it: TV, Literature, Art, and Admin
Group[] groups = m_db.groups();
- Assert.assertEquals( 4, groups.length );
+ Assertions.assertEquals( 4, groups.length );
Group group;
// Group TV has 3 members
group = backendGroup( "TV" );
- Assert.assertEquals("TV", group.getName() );
- Assert.assertEquals( 3, group.members().length );
+ Assertions.assertEquals("TV", group.getName() );
+ Assertions.assertEquals( 3, group.members().length );
// Group Literature has 2 members
group = backendGroup( "Literature" );
- Assert.assertEquals("Literature", group.getName() );
- Assert.assertEquals( 2, group.members().length );
+ Assertions.assertEquals("Literature", group.getName() );
+ Assertions.assertEquals( 2, group.members().length );
// Group Art has no members
group = backendGroup( "Art" );
- Assert.assertEquals("Art", group.getName() );
- Assert.assertEquals( 0, group.members().length );
+ Assertions.assertEquals("Art", group.getName() );
+ Assertions.assertEquals( 0, group.members().length );
// Group Admin has 1 member (Administrator)
group = backendGroup( "Admin" );
- Assert.assertEquals("Admin", group.getName() );
- Assert.assertEquals( 1, group.members().length );
- Assert.assertEquals( "Administrator", group.members()[0].getName() );
+ Assertions.assertEquals("Admin", group.getName() );
+ Assertions.assertEquals( 1, group.members().length );
+ Assertions.assertEquals( "Administrator", group.members()[0].getName() );
// Group Archaeology doesn't exist
try
{
group = backendGroup( "Archaeology" );
// We should never get here
- Assert.assertTrue(false);
+ Assertions.assertTrue(false);
}
catch (NoSuchPrincipalException e)
{
- Assert.assertTrue(true);
+ Assertions.assertTrue(true);
}
}
@@ -191,20 +191,20 @@ public class JDBCGroupDatabaseTest
// Make sure the profile saved successfully
group = backendGroup( name );
- Assert.assertEquals( name, group.getName() );
- Assert.assertEquals( 3, group.members().length );
- Assert.assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
- Assert.assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
- Assert.assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );
+ Assertions.assertEquals( name, group.getName() );
+ Assertions.assertEquals( 3, group.members().length );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );
// The back-end should have timestamped the create/modify fields
- Assert.assertNotNull( group.getCreator() );
- Assert.assertEquals( "Tester", group.getCreator() );
- Assert.assertNotNull( group.getCreated() );
- Assert.assertNotNull( group.getModifier() );
- Assert.assertEquals( "Tester", group.getModifier() );
- Assert.assertNotNull( group.getLastModified() );
- Assert.assertNotSame( group.getCreated(), group.getLastModified() );
+ Assertions.assertNotNull( group.getCreator() );
+ Assertions.assertEquals( "Tester", group.getCreator() );
+ Assertions.assertNotNull( group.getCreated() );
+ Assertions.assertNotNull( group.getModifier() );
+ Assertions.assertEquals( "Tester", group.getModifier() );
+ Assertions.assertNotNull( group.getLastModified() );
+ Assertions.assertNotSame( group.getCreated(), group.getLastModified() );
// Remove the group
m_db.delete( group );
@@ -226,7 +226,7 @@ public class JDBCGroupDatabaseTest
// Make sure the profile saved successfully
group = backendGroup( name );
- Assert.assertEquals( name, group.getName() );
+ Assertions.assertEquals( name, group.getName() );
// Modify the members by adding the group; re-add Al while we're at it
Principal dave = new WikiPrincipal( "Dave" );
@@ -236,24 +236,24 @@ public class JDBCGroupDatabaseTest
// We should see 4 members and new timestamp info
Principal[] members = group.members();
- Assert.assertEquals( 4, members.length );
- Assert.assertNotNull( group.getCreator() );
- Assert.assertEquals( "Tester", group.getCreator() );
- Assert.assertNotNull( group.getCreated() );
- Assert.assertNotNull( group.getModifier() );
- Assert.assertEquals( "SecondTester", group.getModifier() );
- Assert.assertNotNull( group.getLastModified() );
+ Assertions.assertEquals( 4, members.length );
+ Assertions.assertNotNull( group.getCreator() );
+ Assertions.assertEquals( "Tester", group.getCreator() );
+ Assertions.assertNotNull( group.getCreated() );
+ Assertions.assertNotNull( group.getModifier() );
+ Assertions.assertEquals( "SecondTester", group.getModifier() );
+ Assertions.assertNotNull( group.getLastModified() );
// Check the back-end; We should see the same thing
group = backendGroup( name );
members = group.members();
- Assert.assertEquals( 4, members.length );
- Assert.assertNotNull( group.getCreator() );
- Assert.assertEquals( "Tester", group.getCreator() );
- Assert.assertNotNull( group.getCreated() );
- Assert.assertNotNull( group.getModifier() );
- Assert.assertEquals( "SecondTester", group.getModifier() );
- Assert.assertNotNull( group.getLastModified() );
+ Assertions.assertEquals( 4, members.length );
+ Assertions.assertNotNull( group.getCreator() );
+ Assertions.assertEquals( "Tester", group.getCreator() );
+ Assertions.assertNotNull( group.getCreated() );
+ Assertions.assertNotNull( group.getModifier() );
+ Assertions.assertEquals( "SecondTester", group.getModifier() );
+ Assertions.assertNotNull( group.getLastModified() );
// Remove the group
m_db.delete( group );
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/WebContainerAuthorizerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/WebContainerAuthorizerTest.java
index 8744f84..d29df18 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/WebContainerAuthorizerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/WebContainerAuthorizerTest.java
@@ -24,9 +24,9 @@ import org.apache.commons.lang.ArrayUtils;
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiEngine;
import org.jdom2.Document;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class WebContainerAuthorizerTest
{
@@ -34,7 +34,7 @@ public class WebContainerAuthorizerTest
WebContainerAuthorizer m_authorizer;
Document m_webxml;
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -51,9 +51,9 @@ public class WebContainerAuthorizerTest
@Test
public void testConstraints() throws Exception
{
- Assert.assertTrue( m_authorizer.isConstrained( "/Delete.jsp", new Role( "Admin" ) ) );
- Assert.assertTrue( m_authorizer.isConstrained( "/Login.jsp", Role.AUTHENTICATED ) );
- Assert.assertFalse( m_authorizer.isConstrained( "/UserPreferences.jsp", Role.AUTHENTICATED ) );
+ Assertions.assertTrue( m_authorizer.isConstrained( "/Delete.jsp", new Role( "Admin" ) ) );
+ Assertions.assertTrue( m_authorizer.isConstrained( "/Login.jsp", Role.AUTHENTICATED ) );
+ Assertions.assertFalse( m_authorizer.isConstrained( "/UserPreferences.jsp", Role.AUTHENTICATED ) );
}
@Test
@@ -61,9 +61,9 @@ public class WebContainerAuthorizerTest
{
// We should find 2 roles: AUTHENTICATED plus custom role "Admin"
Principal[] roles = m_authorizer.getRoles();
- Assert.assertEquals( 2, roles.length );
- Assert.assertTrue( ArrayUtils.contains( roles, Role.AUTHENTICATED ) );
- Assert.assertTrue( ArrayUtils.contains( roles, new Role( "Admin" ) ) );
+ Assertions.assertEquals( 2, roles.length );
+ Assertions.assertTrue( ArrayUtils.contains( roles, Role.AUTHENTICATED ) );
+ Assertions.assertTrue( ArrayUtils.contains( roles, new Role( "Admin" ) ) );
}
@Test
@@ -78,7 +78,7 @@ public class WebContainerAuthorizerTest
found = true;
}
}
- Assert.assertTrue( "Didn't find AUTHENTICATED", found );
+ Assertions.assertTrue( found, "Didn't find AUTHENTICATED" );
for ( int i = 0; i < roles.length; i++ )
{
if ( roles[i].equals( new Role( "Admin" ) ) )
@@ -86,13 +86,13 @@ public class WebContainerAuthorizerTest
found = true;
}
}
- Assert.assertTrue( "Didn't find ADMIN", found );
+ Assertions.assertTrue( found, "Didn't find ADMIN" );
}
@Test
public void testIsContainerAuthorized()
{
- Assert.assertTrue( m_authorizer.isContainerAuthorized() );
+ Assertions.assertTrue( m_authorizer.isContainerAuthorized() );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/XMLGroupDatabaseTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/XMLGroupDatabaseTest.java
index 0775b1c..f7eb1cb 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/XMLGroupDatabaseTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/authorize/XMLGroupDatabaseTest.java
@@ -27,9 +27,9 @@ import org.apache.wiki.api.exceptions.WikiException;
import org.apache.wiki.auth.NoSuchPrincipalException;
import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.WikiSecurityException;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
@@ -44,7 +44,7 @@ public class XMLGroupDatabaseTest
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
@@ -70,53 +70,53 @@ public class XMLGroupDatabaseTest
// Make sure the profile saved successfully
group = backendGroup( name );
- Assert.assertEquals( name, group.getName() );
- Assert.assertEquals( oldUserCount+1, m_db.groups().length );
+ Assertions.assertEquals( name, group.getName() );
+ Assertions.assertEquals( oldUserCount+1, m_db.groups().length );
// Now delete the profile; should be back to old count
m_db.delete( group );
- Assert.assertEquals( oldUserCount, m_db.groups().length );
+ Assertions.assertEquals( oldUserCount, m_db.groups().length );
}
@Test
public void testGroups() throws WikiSecurityException {
// Test file has 4 groups in it: TV, Literature, Art, and Admin
Group[] groups = m_db.groups();
- Assert.assertEquals( 4, groups.length );
+ Assertions.assertEquals( 4, groups.length );
Group group;
// Group TV has 3 members
group = backendGroup( "TV" );
- Assert.assertEquals("TV", group.getName() );
- Assert.assertEquals( 3, group.members().length );
+ Assertions.assertEquals("TV", group.getName() );
+ Assertions.assertEquals( 3, group.members().length );
// Group Literature has 2 members
group = backendGroup( "Literature" );
- Assert.assertEquals("Literature", group.getName() );
- Assert.assertEquals( 2, group.members().length );
+ Assertions.assertEquals("Literature", group.getName() );
+ Assertions.assertEquals( 2, group.members().length );
// Group Art has no members
group = backendGroup( "Art" );
- Assert.assertEquals("Art", group.getName() );
- Assert.assertEquals( 0, group.members().length );
+ Assertions.assertEquals("Art", group.getName() );
+ Assertions.assertEquals( 0, group.members().length );
// Group Admin has 1 member (Administrator)
group = backendGroup( "Admin" );
- Assert.assertEquals("Admin", group.getName() );
- Assert.assertEquals( 1, group.members().length );
- Assert.assertEquals( "Administrator", group.members()[0].getName() );
+ Assertions.assertEquals("Admin", group.getName() );
+ Assertions.assertEquals( 1, group.members().length );
+ Assertions.assertEquals( "Administrator", group.members()[0].getName() );
// Group Archaeology doesn't exist
try
{
group = backendGroup( "Archaeology" );
// We should never get here
- Assert.assertTrue(false);
+ Assertions.assertTrue(false);
}
catch (NoSuchPrincipalException e)
{
- Assert.assertTrue(true);
+ Assertions.assertTrue(true);
}
}
@@ -135,20 +135,20 @@ public class XMLGroupDatabaseTest
// Make sure the profile saved successfully
group = backendGroup( name );
- Assert.assertEquals( name, group.getName() );
- Assert.assertEquals( 3, group.members().length );
- Assert.assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
- Assert.assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
- Assert.assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );
+ Assertions.assertEquals( name, group.getName() );
+ Assertions.assertEquals( 3, group.members().length );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
+ Assertions.assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );
// The back-end should have timestamped the create/modify fields
- Assert.assertNotNull( group.getCreator() );
- Assert.assertEquals( "Tester", group.getCreator() );
- Assert.assertNotNull( group.getCreated() );
- Assert.assertNotNull( group.getModifier() );
- Assert.assertEquals( "Tester", group.getModifier() );
- Assert.assertNotNull( group.getLastModified() );
- Assert.assertNotSame( group.getCreated(), group.getLastModified() );
+ Assertions.assertNotNull( group.getCreator() );
+ Assertions.assertEquals( "Tester", group.getCreator() );
+ Assertions.assertNotNull( group.getCreated() );
+ Assertions.assertNotNull( group.getModifier() );
+ Assertions.assertEquals( "Tester", group.getModifier() );
+ Assertions.assertNotNull( group.getLastModified() );
+ Assertions.assertNotSame( group.getCreated(), group.getLastModified() );
// Remove the group
m_db.delete( group );
@@ -169,7 +169,7 @@ public class XMLGroupDatabaseTest
// Make sure the profile saved successfully
group = backendGroup( name );
- Assert.assertEquals( name, group.getName() );
+ Assertions.assertEquals( name, group.getName() );
// Modify the members by adding the group; re-add Al while we're at it
Principal dave = new WikiPrincipal( "Dave" );
@@ -179,24 +179,24 @@ public class XMLGroupDatabaseTest
// We should see 4 members and new timestamp info
Principal[] members = group.members();
- Assert.assertEquals( 4, members.length );
- Assert.assertNotNull( group.getCreator() );
- Assert.assertEquals( "Tester", group.getCreator() );
- Assert.assertNotNull( group.getCreated() );
- Assert.assertNotNull( group.getModifier() );
- Assert.assertEquals( "SecondTester", group.getModifier() );
- Assert.assertNotNull( group.getLastModified() );
+ Assertions.assertEquals( 4, members.length );
+ Assertions.assertNotNull( group.getCreator() );
+ Assertions.assertEquals( "Tester", group.getCreator() );
+ Assertions.assertNotNull( group.getCreated() );
+ Assertions.assertNotNull( group.getModifier() );
+ Assertions.assertEquals( "SecondTester", group.getModifier() );
+ Assertions.assertNotNull( group.getLastModified() );
// Check the back-end; We should see the same thing
group = backendGroup( name );
members = group.members();
- Assert.assertEquals( 4, members.length );
- Assert.assertNotNull( group.getCreator() );
- Assert.assertEquals( "Tester", group.getCreator() );
- Assert.assertNotNull( group.getCreated() );
- Assert.assertNotNull( group.getModifier() );
- Assert.assertEquals( "SecondTester", group.getModifier() );
- Assert.assertNotNull( group.getLastModified() );
+ Assertions.assertEquals( 4, members.length );
+ Assertions.assertNotNull( group.getCreator() );
+ Assertions.assertEquals( "Tester", group.getCreator() );
+ Assertions.assertNotNull( group.getCreated() );
+ Assertions.assertNotNull( group.getModifier() );
+ Assertions.assertEquals( "SecondTester", group.getModifier() );
+ Assertions.assertNotNull( group.getLastModified() );
// Remove the group
m_db.delete( group );
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
index 823fbfd..b19335f 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
@@ -34,8 +34,8 @@ import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
-import org.junit.Assert;
-import org.junit.Before;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
/**
*/
@@ -59,15 +59,15 @@ public class AnonymousLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
- Assert.assertFalse( principals.contains( Role.ANONYMOUS ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
+ Assertions.assertFalse( principals.contains( Role.ANONYMOUS ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
@@ -84,24 +84,24 @@ public class AnonymousLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
- Assert.assertFalse( principals.contains( Role.ANONYMOUS ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
+ Assertions.assertFalse( principals.contains( Role.ANONYMOUS ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
module.logout();
- Assert.assertEquals( 0, principals.size() );
+ Assertions.assertEquals( 0, principals.size() );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -116,7 +116,7 @@ public class AnonymousLoginModuleTest
catch( NoRequiredPropertyException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
index 9c4c4d6..d9cf043 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
@@ -34,8 +34,8 @@ import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
-import org.junit.Assert;
-import org.junit.Before;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
import net.sourceforge.stripes.mock.MockHttpServletRequest;
@@ -55,7 +55,7 @@ public class CookieAssertionLoginModuleTest
try
{
// We can use cookies right?
- Assert.assertTrue( m_engine.getAuthenticationManager().allowsCookieAssertions() );
+ Assertions.assertTrue( m_engine.getAuthenticationManager().allowsCookieAssertions() );
// Test using Cookie and IP address (AnonymousLoginModule succeeds)
Cookie cookie = new Cookie( CookieAssertionLoginModule.PREFS_COOKIE_NAME, "Bullwinkle" );
@@ -69,15 +69,15 @@ public class CookieAssertionLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
- Assert.assertFalse( principals.contains( Role.ASSERTED ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
+ Assertions.assertFalse( principals.contains( Role.ASSERTED ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
@@ -96,24 +96,24 @@ public class CookieAssertionLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
- Assert.assertFalse( principals.contains( Role.ANONYMOUS ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
+ Assertions.assertFalse( principals.contains( Role.ANONYMOUS ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
module.logout();
- Assert.assertEquals( 0, principals.size() );
+ Assertions.assertEquals( 0, principals.size() );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -128,7 +128,7 @@ public class CookieAssertionLoginModuleTest
catch( NoRequiredPropertyException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
index d229ec9..59fcfab 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
@@ -34,8 +34,8 @@ import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
-import org.junit.Assert;
-import org.junit.Before;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
/**
*/
@@ -60,10 +60,10 @@ public class UserDatabaseLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
- Assert.assertFalse( principals.contains( Role.AUTHENTICATED ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
+ Assertions.assertFalse( principals.contains( Role.AUTHENTICATED ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
// Login with a user that IS in the database
m_subject = new Subject();
@@ -75,15 +75,15 @@ public class UserDatabaseLoginModuleTest
module.login();
module.commit();
principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( new WikiPrincipal( "janne", WikiPrincipal.LOGIN_NAME ) ) );
- Assert.assertFalse( principals.contains( Role.AUTHENTICATED ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( new WikiPrincipal( "janne", WikiPrincipal.LOGIN_NAME ) ) );
+ Assertions.assertFalse( principals.contains( Role.AUTHENTICATED ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
@@ -99,24 +99,24 @@ public class UserDatabaseLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
- Assert.assertFalse( principals.contains( Role.AUTHENTICATED ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
+ Assertions.assertFalse( principals.contains( Role.AUTHENTICATED ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
module.logout();
- Assert.assertEquals( 0, principals.size() );
+ Assertions.assertEquals( 0, principals.size() );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -131,7 +131,7 @@ public class UserDatabaseLoginModuleTest
catch( NoRequiredPropertyException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
index 6cee4d0..fc256e7 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
@@ -33,8 +33,8 @@ import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
-import org.junit.Assert;
-import org.junit.Before;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
import net.sourceforge.stripes.mock.MockHttpServletRequest;
@@ -63,17 +63,17 @@ public class WebContainerLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( principal ) );
- Assert.assertFalse( principals.contains( Role.ANONYMOUS ) );
- Assert.assertFalse( principals.contains( Role.ASSERTED ) );
- Assert.assertFalse( principals.contains( Role.AUTHENTICATED ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( principal ) );
+ Assertions.assertFalse( principals.contains( Role.ANONYMOUS ) );
+ Assertions.assertFalse( principals.contains( Role.ASSERTED ) );
+ Assertions.assertFalse( principals.contains( Role.AUTHENTICATED ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
@@ -92,21 +92,21 @@ public class WebContainerLoginModuleTest
module.login();
module.commit();
Set< Principal > principals = m_subject.getPrincipals();
- Assert.assertEquals( 1, principals.size() );
- Assert.assertTrue( principals.contains( principal ) );
- Assert.assertFalse( principals.contains( Role.AUTHENTICATED ) );
- Assert.assertFalse( principals.contains( Role.ALL ) );
+ Assertions.assertEquals( 1, principals.size() );
+ Assertions.assertTrue( principals.contains( principal ) );
+ Assertions.assertFalse( principals.contains( Role.AUTHENTICATED ) );
+ Assertions.assertFalse( principals.contains( Role.ALL ) );
module.logout();
- Assert.assertEquals( 0, principals.size() );
+ Assertions.assertEquals( 0, principals.size() );
}
catch( LoginException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -121,7 +121,7 @@ public class WebContainerLoginModuleTest
catch( NoRequiredPropertyException e )
{
System.err.println( e.getMessage() );
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
index d8e4815..236af26 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
@@ -20,9 +20,9 @@ package org.apache.wiki.auth.permissions;
import java.security.Permission;
import java.util.Enumeration;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
*/
@@ -34,7 +34,7 @@ public class AllPermissionCollectionTest
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
c_all = new AllPermissionCollection();
@@ -49,17 +49,17 @@ public class AllPermissionCollectionTest
AllPermission all4 = new AllPermission( "*" );
c_all.add( all1 );
- Assert.assertEquals( 1, count( c_all ) );
+ Assertions.assertEquals( 1, count( c_all ) );
c_all.add( all2 );
- Assert.assertEquals( 2, count( c_all ) );
+ Assertions.assertEquals( 2, count( c_all ) );
c_all.add( all3 );
- Assert.assertEquals( 3, count( c_all ) );
+ Assertions.assertEquals( 3, count( c_all ) );
// The last one is a duplicate and shouldn't be counted...
c_all.add( all4 );
- Assert.assertEquals( 3, count( c_all ) );
+ Assertions.assertEquals( 3, count( c_all ) );
}
@Test
@@ -71,17 +71,17 @@ public class AllPermissionCollectionTest
PagePermission p4 = new PagePermission( "JSPWiki:Main", "edit" );
c_all.add( p1 );
- Assert.assertEquals( 1, count( c_all ) );
+ Assertions.assertEquals( 1, count( c_all ) );
c_all.add( p2 );
- Assert.assertEquals( 2, count( c_all ) );
+ Assertions.assertEquals( 2, count( c_all ) );
c_all.add( p3 );
- Assert.assertEquals( 3, count( c_all ) );
+ Assertions.assertEquals( 3, count( c_all ) );
// The last one is a duplicate and shouldn't be counted...
c_all.add( p4 );
- Assert.assertEquals( 3, count( c_all ) );
+ Assertions.assertEquals( 3, count( c_all ) );
}
@Test
@@ -93,17 +93,17 @@ public class AllPermissionCollectionTest
WikiPermission p4 = new WikiPermission( "JSPWiki", "login" );
c_all.add( p1 );
- Assert.assertEquals( 1, count( c_all ) );
+ Assertions.assertEquals( 1, count( c_all ) );
c_all.add( p2 );
- Assert.assertEquals( 2, count( c_all ) );
+ Assertions.assertEquals( 2, count( c_all ) );
c_all.add( p3 );
- Assert.assertEquals( 3, count( c_all ) );
+ Assertions.assertEquals( 3, count( c_all ) );
// The last one is a duplicate and shouldn't be counted...
c_all.add( p4 );
- Assert.assertEquals( 3, count( c_all ) );
+ Assertions.assertEquals( 3, count( c_all ) );
}
@Test
@@ -112,14 +112,14 @@ public class AllPermissionCollectionTest
AllPermission all1 = new AllPermission( "*" );
AllPermission all2 = new AllPermission( "JSPWiki" );
- Assert.assertFalse( c_all.isReadOnly() );
+ Assertions.assertFalse( c_all.isReadOnly() );
c_all.add( all1 );
- Assert.assertFalse( c_all.isReadOnly() );
+ Assertions.assertFalse( c_all.isReadOnly() );
// Mark as read-only; isReadOnly should return "true", as we'll get an
// error
c_all.setReadOnly();
- Assert.assertTrue( c_all.isReadOnly() );
+ Assertions.assertTrue( c_all.isReadOnly() );
boolean exception = false;
try
{
@@ -133,7 +133,7 @@ public class AllPermissionCollectionTest
if ( !exception )
{
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
@@ -146,27 +146,27 @@ public class AllPermissionCollectionTest
AllPermission all4 = new AllPermission( "*" );
c_all.add( all1 );
- Assert.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
- Assert.assertFalse( c_all.implies( new AllPermission( "myWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
+ Assertions.assertFalse( c_all.implies( new AllPermission( "myWiki" ) ) );
c_all.add( all2 );
- Assert.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "myWiki" ) ) );
- Assert.assertFalse( c_all.implies( new AllPermission( "bigTimeWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "myWiki" ) ) );
+ Assertions.assertFalse( c_all.implies( new AllPermission( "bigTimeWiki" ) ) );
c_all.add( all3 );
- Assert.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "myWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "bigTimeWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "bigBigBigWiki" ) ) );
- Assert.assertFalse( c_all.implies( new AllPermission( "bittyWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "myWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "bigTimeWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "bigBigBigWiki" ) ) );
+ Assertions.assertFalse( c_all.implies( new AllPermission( "bittyWiki" ) ) );
c_all.add( all4 );
- Assert.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "myWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "bigTimeWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "bigBigBigWiki" ) ) );
- Assert.assertTrue( c_all.implies( new AllPermission( "bittyWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "JSPWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "myWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "bigTimeWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "bigBigBigWiki" ) ) );
+ Assertions.assertTrue( c_all.implies( new AllPermission( "bittyWiki" ) ) );
}
@Test
@@ -176,18 +176,18 @@ public class AllPermissionCollectionTest
AllPermission all2 = new AllPermission( "*" );
c_all.add( all1 );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Main", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:GroupAdmin", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Foobar", "delete" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "myWiki:Foobar", "delete" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:*", "view" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Main", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:GroupAdmin", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Foobar", "delete" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "myWiki:Foobar", "delete" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:*", "view" ) ) );
c_all.add( all2 );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Main", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:GroupAdmin", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Foobar", "delete" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "myWiki:Foobar", "delete" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:*", "view" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Main", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:GroupAdmin", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:Foobar", "delete" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "myWiki:Foobar", "delete" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:*", "view" ) ) );
}
@Test
@@ -197,18 +197,18 @@ public class AllPermissionCollectionTest
AllPermission all2 = new AllPermission( "*" );
c_all.add( all1 );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "createGroups" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "editPreferences" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "createGroups" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "editPreferences" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
c_all.add( all2 );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "createGroups" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "editPreferences" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "createGroups" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "editPreferences" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
}
@Test
@@ -220,44 +220,44 @@ public class AllPermissionCollectionTest
Permission p4 = new AllPermission( "*" );
c_all.add( p1 );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
c_all.add( p2 );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
c_all.add( p3 );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
- Assert.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
- Assert.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
+ Assertions.assertFalse( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
+ Assertions.assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
c_all.add( p4 );
- Assert.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
- Assert.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "myWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
+ Assertions.assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
}
private int count( AllPermissionCollection collection )
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionTest.java
index bab615c..2da7062 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.wiki.auth.permissions;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
/**
*/
@@ -35,10 +35,10 @@ public class AllPermissionTest
AllPermission p1 = new AllPermission( "*" );
AllPermission p2 = new AllPermission( "*" );
AllPermission p3 = new AllPermission( "myWiki" );
- Assert.assertTrue( p1.equals( p2 ) );
- Assert.assertTrue( p2.equals( p1 ) );
- Assert.assertFalse( p1.equals( p3 ) );
- Assert.assertFalse( p3.equals( p1 ) );
+ Assertions.assertTrue( p1.equals( p2 ) );
+ Assertions.assertTrue( p2.equals( p1 ) );
+ Assertions.assertFalse( p1.equals( p3 ) );
+ Assertions.assertFalse( p3.equals( p1 ) );
}
@Test
@@ -46,12 +46,12 @@ public class AllPermissionTest
{
AllPermission p1 = new AllPermission( "*" );
AllPermission p2 = new AllPermission( "*" );
- Assert.assertTrue( p1.equals( p2 ) );
- Assert.assertTrue( p2.equals( p1 ) );
+ Assertions.assertTrue( p1.equals( p2 ) );
+ Assertions.assertTrue( p2.equals( p1 ) );
p2 = new AllPermission( "myWiki" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
}
@Test
@@ -59,20 +59,20 @@ public class AllPermissionTest
{
AllPermission p1 = new AllPermission( "*" );
PagePermission p2 = new PagePermission( "*:TestPage", "delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
p2 = new PagePermission( "myWiki:TestPage", "delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
p2 = new PagePermission( "*:GroupTest", "delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
p2 = new PagePermission( "myWiki:GroupTest", "delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
}
@Test
@@ -80,12 +80,12 @@ public class AllPermissionTest
{
AllPermission p1 = new AllPermission( "*" );
WikiPermission p2 = new WikiPermission( "*", "createPages" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
p2 = new WikiPermission( "myWiki", "createPages" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
}
/*
@@ -96,11 +96,11 @@ public class AllPermissionTest
{
AllPermission p = new AllPermission( "myWiki" );
String result = "(\"org.apache.wiki.auth.permissions.AllPermission\",\"myWiki\")";
- Assert.assertEquals( result, p.toString() );
+ Assertions.assertEquals( result, p.toString() );
p = new AllPermission( "*" );
result = "(\"org.apache.wiki.auth.permissions.AllPermission\",\"*\")";
- Assert.assertEquals( result, p.toString() );
+ Assertions.assertEquals( result, p.toString() );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/GroupPermissionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/GroupPermissionTest.java
index f3a04ab..0f10692 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/GroupPermissionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/GroupPermissionTest.java
@@ -26,7 +26,7 @@ import javax.security.auth.Subject;
import org.apache.wiki.auth.GroupPrincipal;
import org.apache.wiki.auth.WikiPrincipal;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
public class GroupPermissionTest
{
@@ -40,18 +40,18 @@ public class GroupPermissionTest
GroupPermission p2 = new GroupPermission( "mywiki:Test", "view,edit,delete" );
GroupPermission p3 = new GroupPermission( "mywiki:Test", "delete,view,edit" );
GroupPermission p4 = new GroupPermission( "mywiki:Test*", "delete,view,edit" );
- Assert.assertEquals( p1, p2 );
- Assert.assertEquals( p1, p3 );
- Assert.assertFalse( p3.equals( p4 ) );
+ Assertions.assertEquals( p1, p2 );
+ Assertions.assertEquals( p1, p3 );
+ Assertions.assertFalse( p3.equals( p4 ) );
}
public final void testCreateMask()
{
- Assert.assertEquals( 1, GroupPermission.createMask( "view" ) );
- Assert.assertEquals( 7, GroupPermission.createMask( "view,edit,delete" ) );
- Assert.assertEquals( 7, GroupPermission.createMask( "edit,delete,view" ) );
- Assert.assertEquals( 2, GroupPermission.createMask( "edit" ) );
- Assert.assertEquals( 6, GroupPermission.createMask( "edit,delete" ) );
+ Assertions.assertEquals( 1, GroupPermission.createMask( "view" ) );
+ Assertions.assertEquals( 7, GroupPermission.createMask( "view,edit,delete" ) );
+ Assertions.assertEquals( 7, GroupPermission.createMask( "edit,delete,view" ) );
+ Assertions.assertEquals( 2, GroupPermission.createMask( "edit" ) );
+ Assertions.assertEquals( 6, GroupPermission.createMask( "edit,delete" ) );
}
/*
@@ -61,10 +61,10 @@ public class GroupPermissionTest
{
GroupPermission p;
p = new GroupPermission( "Test", "view,edit,delete" );
- Assert.assertEquals( "(\"org.apache.wiki.auth.permissions.GroupPermission\",\"*:Test\",\"delete,edit,view\")", p
+ Assertions.assertEquals( "(\"org.apache.wiki.auth.permissions.GroupPermission\",\"*:Test\",\"delete,edit,view\")", p
.toString() );
p = new GroupPermission( "mywiki:Test", "view,edit,delete" );
- Assert.assertEquals( "(\"org.apache.wiki.auth.permissions.GroupPermission\",\"mywiki:Test\",\"delete,edit,view\")", p
+ Assertions.assertEquals( "(\"org.apache.wiki.auth.permissions.GroupPermission\",\"mywiki:Test\",\"delete,edit,view\")", p
.toString() );
}
@@ -79,20 +79,20 @@ public class GroupPermissionTest
// Permissions without prepended wiki name should imply themselves
p1 = new GroupPermission( "Test", "edit" );
p2 = new GroupPermission( "Test", "edit" );
- Assert.assertTrue( p1.implies( p1 ) );
- Assert.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
// Permissions with a wildcard wiki should imply other wikis
p1 = new GroupPermission( "*:Test", "edit" );
p2 = new GroupPermission( "mywiki:Test", "edit" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
// Permissions that start with ":" are just like "*:"
p1 = new GroupPermission( "*:Test", "edit" );
p2 = new GroupPermission( "Test", "edit" );
- Assert.assertTrue( p1.implies( p1 ) );
- Assert.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
}
public final void testImpliesMember()
@@ -106,28 +106,28 @@ public class GroupPermissionTest
p2 = new GroupPermission ("*:TestGroup", "view" );
s = new Subject();
s.getPrincipals().add( new GroupPrincipal( "TestGroup" ) );
- Assert.assertTrue( subjectImplies( s, p1, p2 ) );
+ Assertions.assertTrue( subjectImplies( s, p1, p2 ) );
// <groupmember> doesn't imply it if Subject has no GroupPermission("TestGroup")
s = new Subject();
s.getPrincipals().add( new WikiPrincipal( "TestGroup" ) );
- Assert.assertFalse( subjectImplies( s, p1, p2 ) );
+ Assertions.assertFalse( subjectImplies( s, p1, p2 ) );
// <groupmember> doesn't imply it if Subject's GP doesn't match
s = new Subject();
s.getPrincipals().add( new GroupPrincipal( "FooGroup" ) );
- Assert.assertFalse( subjectImplies( s, p1, p2 ) );
+ Assertions.assertFalse( subjectImplies( s, p1, p2 ) );
// <groupmember> doesn't imply it if p2 isn't GroupPermission type
p2 = new PagePermission ("*:TestGroup", "view" );
s = new Subject();
s.getPrincipals().add( new GroupPrincipal( "TestGroup" ) );
- Assert.assertFalse( subjectImplies( s, p1, p2 ) );
+ Assertions.assertFalse( subjectImplies( s, p1, p2 ) );
// <groupmember> implies TestGroup if not called with Subject combiner
p1 = new GroupPermission( "*:<groupmember>", "view" );
p2 = new GroupPermission ("*:TestGroup", "view" );
- Assert.assertFalse( p1.impliesMember( p2 ) );
+ Assertions.assertFalse( p1.impliesMember( p2 ) );
}
@@ -143,145 +143,145 @@ public class GroupPermissionTest
// The same permission should imply itself
p1 = new GroupPermission( "mywiki:Test", "view,edit,delete" );
p2 = new GroupPermission( "mywiki:Test", "view,edit,delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p2.implies( p1 ) );
// The same permission should imply itself for wildcard wikis
p1 = new GroupPermission( "Test", "view,edit,delete" );
p2 = new GroupPermission( "*:Test", "view,edit,delete" );
p3 = new GroupPermission( "mywiki:Test", "view,edit,delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p2.implies( p1 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertTrue( p2.implies( p3 ) );
- Assert.assertFalse( p3.implies( p1 ) );
- Assert.assertFalse( p3.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertTrue( p2.implies( p3 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p2 ) );
// Actions on collection should imply permission for group with same
// actions
p1 = new GroupPermission( "*:*", "view,edit,delete" );
p2 = new GroupPermission( "*:Test", "view,edit,delete" );
p3 = new GroupPermission( "mywiki:Test", "view,edit,delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertTrue( p2.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertTrue( p2.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Actions on single group should imply subset of those actions
p1 = new GroupPermission( "*:Test", "view,edit,delete" );
p2 = new GroupPermission( "*:Test", "view" );
p3 = new GroupPermission( "mywiki:Test", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
- Assert.assertFalse( p3.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p2 ) );
// Actions on collection should imply subset of actions on single group
p1 = new GroupPermission( "*:*", "view,edit,delete" );
p2 = new GroupPermission( "*:Test", "view" );
p3 = new GroupPermission( "mywiki:Test", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p1 = new GroupPermission( "*:Tes*", "view,edit,delete" );
p2 = new GroupPermission( "*:Test", "view" );
p3 = new GroupPermission( "mywiki:Test", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p1 = new GroupPermission( "*:*st", "view,edit,delete" );
p2 = new GroupPermission( "*:Test", "view" );
p3 = new GroupPermission( "mywiki:Test", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Delete action on collection should imply edit/view on
// single group
p1 = new GroupPermission( "*:*st", "delete" );
p2 = new GroupPermission( "*:Test", "edit" );
p3 = new GroupPermission( "mywiki:Test", "edit" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p2 = new GroupPermission( "*:Test", "view" );
p3 = new GroupPermission( "mywiki:Test", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Edit action on collection should imply view on single group
p1 = new GroupPermission( "*:*st", "edit" );
p2 = new GroupPermission( "*:Test", "view" );
p3 = new GroupPermission( "mywiki:Test", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Pre- and post- wildcards should also be fine
p1 = new GroupPermission( "*:Test*", "view" );
p2 = new GroupPermission( "*:TestGroup", "view" );
p3 = new GroupPermission( "mywiki:TestGroup", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p1 = new GroupPermission( "*:*Group", "view" );
p2 = new GroupPermission( "*:TestGroup", "view" );
p3 = new GroupPermission( "mywiki:TestGroup", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Wildcards don't imply the <groupmember> target
p1 = new GroupPermission( "*:*", "view" );
p2 = new GroupPermission( "*:<groupmember>", "view" );
- Assert.assertFalse( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
p1 = new GroupPermission( "*:*ber>", "view" );
- Assert.assertFalse( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
}
public final void testImplies()
{
- Assert.assertTrue( GroupPermission.DELETE.implies( GroupPermission.EDIT ) );
- Assert.assertTrue( GroupPermission.DELETE.implies( GroupPermission.VIEW ) );
- Assert.assertTrue( GroupPermission.EDIT.implies( GroupPermission.VIEW ) );
+ Assertions.assertTrue( GroupPermission.DELETE.implies( GroupPermission.EDIT ) );
+ Assertions.assertTrue( GroupPermission.DELETE.implies( GroupPermission.VIEW ) );
+ Assertions.assertTrue( GroupPermission.EDIT.implies( GroupPermission.VIEW ) );
}
public final void testImpliedMask()
{
int result = ( GroupPermission.DELETE_MASK | GroupPermission.EDIT_MASK | GroupPermission.VIEW_MASK );
- Assert.assertEquals( result, GroupPermission.impliedMask( GroupPermission.DELETE_MASK ) );
+ Assertions.assertEquals( result, GroupPermission.impliedMask( GroupPermission.DELETE_MASK ) );
result = ( GroupPermission.EDIT_MASK | GroupPermission.VIEW_MASK );
- Assert.assertEquals( result, GroupPermission.impliedMask( GroupPermission.EDIT_MASK ) );
+ Assertions.assertEquals( result, GroupPermission.impliedMask( GroupPermission.EDIT_MASK ) );
}
public final void testGetName()
{
GroupPermission p;
p = new GroupPermission( "Test", "view,edit,delete" );
- Assert.assertEquals( "Test", p.getName() );
+ Assertions.assertEquals( "Test", p.getName() );
p = new GroupPermission( "mywiki:Test", "view,edit,delete" );
- Assert.assertEquals( "mywiki:Test", p.getName() );
- Assert.assertNotSame( "*:Test", p.getName() );
+ Assertions.assertEquals( "mywiki:Test", p.getName() );
+ Assertions.assertNotSame( "*:Test", p.getName() );
}
/*
@@ -290,7 +290,7 @@ public class GroupPermissionTest
public final void testGetActions()
{
GroupPermission p = new GroupPermission( "Test", "VIEW,edit,delete" );
- Assert.assertEquals( "delete,edit,view", p.getActions() );
+ Assertions.assertEquals( "delete,edit,view", p.getActions() );
}
/**
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/PagePermissionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/PagePermissionTest.java
index 02769a6..4caf233 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/PagePermissionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/PagePermissionTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.wiki.auth.permissions;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
/**
*/
@@ -34,17 +34,17 @@ public class PagePermissionTest
PagePermission p2 = new PagePermission( "mywiki:Main", "view,edit,delete" );
PagePermission p3 = new PagePermission( "mywiki:Main", "delete,view,edit" );
PagePermission p4 = new PagePermission( "mywiki:Main*", "delete,view,edit" );
- Assert.assertEquals( p1, p2 );
- Assert.assertEquals( p1, p3 );
- Assert.assertFalse( p3.equals( p4 ) );
+ Assertions.assertEquals( p1, p2 );
+ Assertions.assertEquals( p1, p3 );
+ Assertions.assertFalse( p3.equals( p4 ) );
}
public final void testCreateMask()
{
- Assert.assertEquals( 1, PagePermission.createMask( "view" ) );
- Assert.assertEquals( 19, PagePermission.createMask( "view,edit,delete" ) );
- Assert.assertEquals( 19, PagePermission.createMask( "edit,delete,view" ) );
- Assert.assertEquals( 14, PagePermission.createMask( "edit,comment,upload" ) );
+ Assertions.assertEquals( 1, PagePermission.createMask( "view" ) );
+ Assertions.assertEquals( 19, PagePermission.createMask( "view,edit,delete" ) );
+ Assertions.assertEquals( 19, PagePermission.createMask( "edit,delete,view" ) );
+ Assertions.assertEquals( 14, PagePermission.createMask( "edit,comment,upload" ) );
}
/*
@@ -54,9 +54,9 @@ public class PagePermissionTest
{
PagePermission p;
p = new PagePermission( "Main", "view,edit,delete" );
- Assert.assertEquals( "(\"org.apache.wiki.auth.permissions.PagePermission\",\":Main\",\"delete,edit,view\")", p.toString() );
+ Assertions.assertEquals( "(\"org.apache.wiki.auth.permissions.PagePermission\",\":Main\",\"delete,edit,view\")", p.toString() );
p = new PagePermission( "mywiki:Main", "view,edit,delete" );
- Assert.assertEquals( "(\"org.apache.wiki.auth.permissions.PagePermission\",\"mywiki:Main\",\"delete,edit,view\")", p.toString() );
+ Assertions.assertEquals( "(\"org.apache.wiki.auth.permissions.PagePermission\",\"mywiki:Main\",\"delete,edit,view\")", p.toString() );
}
/**
@@ -71,20 +71,20 @@ public class PagePermissionTest
// or others
p1 = new PagePermission( "Main", "edit" );
p2 = new PagePermission( "Main", "edit" );
- Assert.assertFalse( p1.implies( p1 ) );
- Assert.assertFalse( p1.implies( p2 ) );
+ Assertions.assertFalse( p1.implies( p1 ) );
+ Assertions.assertFalse( p1.implies( p2 ) );
// Permissions with a wildcard wiki should imply other wikis
p1 = new PagePermission( "*:Main", "edit" );
p2 = new PagePermission( "mywiki:Main", "edit" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
// Permissions that start with ":" are just like null
p1 = new PagePermission( ":Main", "edit" );
p2 = new PagePermission( "Main", "edit" );
- Assert.assertFalse( p1.implies( p1 ) );
- Assert.assertFalse( p1.implies( p2 ) );
+ Assertions.assertFalse( p1.implies( p1 ) );
+ Assertions.assertFalse( p1.implies( p2 ) );
}
public final void testImpliesAttachments()
@@ -95,8 +95,8 @@ public class PagePermissionTest
// A page should imply its attachment and vice-versa
p1 = new PagePermission( "mywiki:Main", "view" );
p2 = new PagePermission( "mywiki:Main/test.png", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p2.implies( p1 ) );
}
/*
@@ -111,242 +111,242 @@ public class PagePermissionTest
// The same permission should imply itself
p1 = new PagePermission( "mywiki:Main", "view,edit,delete" );
p2 = new PagePermission( "mywiki:Main", "view,edit,delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p2.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p2.implies( p1 ) );
// The same permission should imply itself for wildcard wikis
p1 = new PagePermission( "Main", "view,edit,delete" );
p2 = new PagePermission( "*:Main", "view,edit,delete" );
p3 = new PagePermission( "mywiki:Main", "view,edit,delete" );
- Assert.assertFalse( p1.implies( p2 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p1.implies( p3 ) );
- Assert.assertTrue( p2.implies( p3 ) );
- Assert.assertFalse( p3.implies( p1 ) );
- Assert.assertFalse( p3.implies( p2 ) );
+ Assertions.assertFalse( p1.implies( p2 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p1.implies( p3 ) );
+ Assertions.assertTrue( p2.implies( p3 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p2 ) );
// Actions on collection should imply permission for page with same
// actions
p1 = new PagePermission( "*:*", "view,edit,delete" );
p2 = new PagePermission( "*:Main", "view,edit,delete" );
p3 = new PagePermission( "mywiki:Main", "view,edit,delete" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertTrue( p2.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertTrue( p2.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Actions on single page should imply subset of those actions
p1 = new PagePermission( "*:Main", "view,edit,delete" );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
- Assert.assertFalse( p3.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p2 ) );
// Actions on collection should imply subset of actions on single page
p1 = new PagePermission( "*:*", "view,edit,delete" );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p1 = new PagePermission( "*:Mai*", "view,edit,delete" );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p1 = new PagePermission( "*:*in", "view,edit,delete" );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Delete action on collection should imply modify/edit/upload/comment/view on
// single page
p1 = new PagePermission( "*:*in", "delete" );
p2 = new PagePermission( "*:Main", "edit" );
p3 = new PagePermission( "mywiki:Main", "edit" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p2 = new PagePermission( "*:Main", "modify" );
p3 = new PagePermission( "mywiki:Main", "modify" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p2 = new PagePermission( "*:Main", "upload" );
p3 = new PagePermission( "mywiki:Main", "upload" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p2 = new PagePermission( "*:Main", "comment" );
p3 = new PagePermission( "mywiki:Main", "comment" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Rename action on collection should imply edit on single page
p1 = new PagePermission( "*:*in", "rename" );
p2 = new PagePermission( "*:Main", "edit" );
p3 = new PagePermission( "mywiki:Main", "edit" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Modify action on collection should imply upload/comment/view on single
// page
p1 = new PagePermission( "*:*in", "modify" );
p2 = new PagePermission( "*:Main", "upload" );
p3 = new PagePermission( "mywiki:Main", "upload" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p2 = new PagePermission( "*:Main", "comment" );
p3 = new PagePermission( "mywiki:Main", "comment" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Upload action on collection should imply view on single page
p1 = new PagePermission( "*:*in", "upload" );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Comment action on collection should imply view on single page
p1 = new PagePermission( "*:*in", "comment" );
p2 = new PagePermission( "*:Main", "view" );
p3 = new PagePermission( "mywiki:Main", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// View action on wildcard collection SHOULD imply view on
// GroupConfiguration page
p1 = new PagePermission( "*:*", "view" );
p2 = new PagePermission( "*:GroupConfiguration", "view" );
p3 = new PagePermission( "mywiki:GroupConfiguration", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
// Pre- and post- wildcards should also be fine
p1 = new PagePermission( "*:Group*", "view" );
p2 = new PagePermission( "*:GroupConfiguration", "view" );
p3 = new PagePermission( "mywiki:GroupConfiguration", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
p1 = new PagePermission( "*:*Configuration", "view" );
p2 = new PagePermission( "*:GroupConfiguration", "view" );
p3 = new PagePermission( "mywiki:GroupConfiguration", "view" );
- Assert.assertTrue( p1.implies( p2 ) );
- Assert.assertTrue( p1.implies( p3 ) );
- Assert.assertFalse( p2.implies( p1 ) );
- Assert.assertFalse( p3.implies( p1 ) );
+ Assertions.assertTrue( p1.implies( p2 ) );
+ Assertions.assertTrue( p1.implies( p3 ) );
+ Assertions.assertFalse( p2.implies( p1 ) );
+ Assertions.assertFalse( p3.implies( p1 ) );
}
public final void testImplies()
{
- Assert.assertFalse(PagePermission.RENAME.implies( PagePermission.MODIFY ) );
- Assert.assertTrue( PagePermission.RENAME.implies( PagePermission.EDIT ) );
- Assert.assertFalse(PagePermission.RENAME.implies( PagePermission.UPLOAD ) );
- Assert.assertTrue( PagePermission.RENAME.implies( PagePermission.COMMENT ) );
- Assert.assertTrue( PagePermission.RENAME.implies( PagePermission.VIEW ) );
+ Assertions.assertFalse(PagePermission.RENAME.implies( PagePermission.MODIFY ) );
+ Assertions.assertTrue( PagePermission.RENAME.implies( PagePermission.EDIT ) );
+ Assertions.assertFalse(PagePermission.RENAME.implies( PagePermission.UPLOAD ) );
+ Assertions.assertTrue( PagePermission.RENAME.implies( PagePermission.COMMENT ) );
+ Assertions.assertTrue( PagePermission.RENAME.implies( PagePermission.VIEW ) );
- Assert.assertTrue( PagePermission.DELETE.implies( PagePermission.MODIFY ) );
- Assert.assertTrue( PagePermission.DELETE.implies( PagePermission.EDIT ) );
- Assert.assertTrue( PagePermission.DELETE.implies( PagePermission.UPLOAD ) );
- Assert.assertTrue( PagePermission.DELETE.implies( PagePermission.COMMENT ) );
- Assert.assertTrue( PagePermission.DELETE.implies( PagePermission.VIEW ) );
+ Assertions.assertTrue( PagePermission.DELETE.implies( PagePermission.MODIFY ) );
+ Assertions.assertTrue( PagePermission.DELETE.implies( PagePermission.EDIT ) );
+ Assertions.assertTrue( PagePermission.DELETE.implies( PagePermission.UPLOAD ) );
+ Assertions.assertTrue( PagePermission.DELETE.implies( PagePermission.COMMENT ) );
+ Assertions.assertTrue( PagePermission.DELETE.implies( PagePermission.VIEW ) );
- Assert.assertTrue( PagePermission.MODIFY.implies( PagePermission.EDIT ) );
- Assert.assertTrue( PagePermission.MODIFY.implies( PagePermission.UPLOAD ) );
- Assert.assertTrue( PagePermission.MODIFY.implies( PagePermission.COMMENT ) );
- Assert.assertTrue( PagePermission.MODIFY.implies( PagePermission.VIEW ) );
+ Assertions.assertTrue( PagePermission.MODIFY.implies( PagePermission.EDIT ) );
+ Assertions.assertTrue( PagePermission.MODIFY.implies( PagePermission.UPLOAD ) );
+ Assertions.assertTrue( PagePermission.MODIFY.implies( PagePermission.COMMENT ) );
+ Assertions.assertTrue( PagePermission.MODIFY.implies( PagePermission.VIEW ) );
- Assert.assertTrue( PagePermission.EDIT.implies( PagePermission.VIEW ) );
- Assert.assertTrue( PagePermission.EDIT.implies( PagePermission.COMMENT ) );
+ Assertions.assertTrue( PagePermission.EDIT.implies( PagePermission.VIEW ) );
+ Assertions.assertTrue( PagePermission.EDIT.implies( PagePermission.COMMENT ) );
- Assert.assertTrue( PagePermission.UPLOAD.implies( PagePermission.VIEW ) );
+ Assertions.assertTrue( PagePermission.UPLOAD.implies( PagePermission.VIEW ) );
- Assert.assertTrue( PagePermission.COMMENT.implies( PagePermission.VIEW ) );
+ Assertions.assertTrue( PagePermission.COMMENT.implies( PagePermission.VIEW ) );
}
public final void testImpliedMask()
{
int result = ( PagePermission.DELETE_MASK | PagePermission.MODIFY_MASK | PagePermission.EDIT_MASK
| PagePermission.COMMENT_MASK | PagePermission.UPLOAD_MASK | PagePermission.VIEW_MASK );
- Assert.assertEquals( result, PagePermission.impliedMask( PagePermission.DELETE_MASK ) );
+ Assertions.assertEquals( result, PagePermission.impliedMask( PagePermission.DELETE_MASK ) );
result = ( PagePermission.RENAME_MASK | PagePermission.EDIT_MASK | PagePermission.COMMENT_MASK
| PagePermission.VIEW_MASK );
- Assert.assertEquals( result, PagePermission.impliedMask( PagePermission.RENAME_MASK ) );
+ Assertions.assertEquals( result, PagePermission.impliedMask( PagePermission.RENAME_MASK ) );
result = ( PagePermission.MODIFY_MASK | PagePermission.EDIT_MASK | PagePermission.COMMENT_MASK
| PagePermission.UPLOAD_MASK | PagePermission.VIEW_MASK );
- Assert.assertEquals( result, PagePermission.impliedMask( PagePermission.MODIFY_MASK ) );
+ Assertions.assertEquals( result, PagePermission.impliedMask( PagePermission.MODIFY_MASK ) );
result = ( PagePermission.EDIT_MASK | PagePermission.COMMENT_MASK | PagePermission.VIEW_MASK );
- Assert.assertEquals( result, PagePermission.impliedMask( PagePermission.EDIT_MASK ) );
+ Assertions.assertEquals( result, PagePermission.impliedMask( PagePermission.EDIT_MASK ) );
result = ( PagePermission.COMMENT_MASK | PagePermission.VIEW_MASK );
- Assert.assertEquals( result, PagePermission.impliedMask( PagePermission.COMMENT_MASK ) );
+ Assertions.assertEquals( result, PagePermission.impliedMask( PagePermission.COMMENT_MASK ) );
result = ( PagePermission.UPLOAD_MASK | PagePermission.VIEW_MASK );
- Assert.assertEquals( result, PagePermission.impliedMask( PagePermission.UPLOAD_MASK ) );
+ Assertions.assertEquals( result, PagePermission.impliedMask( PagePermission.UPLOAD_MASK ) );
}
public final void testGetName()
{
PagePermission p;
p = new PagePermission( "Main", "view,edit,delete" );
- Assert.assertEquals( "Main", p.getName() );
+ Assertions.assertEquals( "Main", p.getName() );
p = new PagePermission( "mywiki:Main", "view,edit,delete" );
- Assert.assertEquals( "mywiki:Main", p.getName() );
- Assert.assertNotSame( "*:Main", p.getName() );
+ Assertions.assertEquals( "mywiki:Main", p.getName() );
+ Assertions.assertNotSame( "*:Main", p.getName() );
}
/*
@@ -355,7 +355,7 @@ public class PagePermissionTest
public final void testGetActions()
{
PagePermission p = new PagePermission( "Main", "VIEW,edit,delete" );
- Assert.assertEquals( "delete,edit,view", p.getActions() );
+ Assertions.assertEquals( "delete,edit,view", p.getActions() );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/WikiPermissionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/WikiPermissionTest.java
index 9c05228..7f9df74 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/WikiPermissionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/WikiPermissionTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.wiki.auth.permissions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
/**
@@ -32,9 +32,9 @@ public class WikiPermissionTest
public void testWikiPermission()
{
WikiPermission p = new WikiPermission("*", "createPages");
- Assert.assertEquals("*", p.getName());
- Assert.assertEquals("*", p.getWiki());
- Assert.assertEquals("createpages", p.getActions());
+ Assertions.assertEquals("*", p.getName());
+ Assertions.assertEquals("*", p.getWiki());
+ Assertions.assertEquals("createpages", p.getActions());
}
/*
@@ -46,13 +46,13 @@ public class WikiPermissionTest
WikiPermission p1 = new WikiPermission("*", "createPages");
WikiPermission p2 = new WikiPermission("*", "createPages");
WikiPermission p3 = new WikiPermission("*", "createGroups");
- Assert.assertTrue(p1.equals(p2));
- Assert.assertTrue(p2.equals(p1));
- Assert.assertFalse(p1.equals(p3));
- Assert.assertFalse(p3.equals(p1));
+ Assertions.assertTrue(p1.equals(p2));
+ Assertions.assertTrue(p2.equals(p1));
+ Assertions.assertFalse(p1.equals(p3));
+ Assertions.assertFalse(p3.equals(p1));
WikiPermission p4 = new WikiPermission("*", "createPages,createGroups");
WikiPermission p5 = new WikiPermission("*", "createGroups,createPages");
- Assert.assertTrue(p4.equals(p5));
+ Assertions.assertTrue(p4.equals(p5));
}
/*
@@ -64,13 +64,13 @@ public class WikiPermissionTest
WikiPermission p1 = new WikiPermission("mywiki", "createPages");
WikiPermission p2 = new WikiPermission("*", "createPages");
WikiPermission p3 = new WikiPermission("mywiki", "createGroups");
- Assert.assertFalse(p1.equals(p2));
- Assert.assertFalse(p2.equals(p1));
- Assert.assertFalse(p1.equals(p3));
- Assert.assertFalse(p3.equals(p1));
+ Assertions.assertFalse(p1.equals(p2));
+ Assertions.assertFalse(p2.equals(p1));
+ Assertions.assertFalse(p1.equals(p3));
+ Assertions.assertFalse(p3.equals(p1));
WikiPermission p4 = new WikiPermission("mywiki", "createPages,createGroups");
WikiPermission p5 = new WikiPermission("*", "createGroups,createPages");
- Assert.assertFalse(p4.equals(p5));
+ Assertions.assertFalse(p4.equals(p5));
}
/*
@@ -80,9 +80,9 @@ public class WikiPermissionTest
public void testGetActions()
{
WikiPermission p1 = new WikiPermission("*", "createPages,createGroups,editProfile");
- Assert.assertEquals("creategroups,createpages,editprofile", p1.getActions());
+ Assertions.assertEquals("creategroups,createpages,editprofile", p1.getActions());
WikiPermission p2 = new WikiPermission("*", "createGroups,editProfile,createPages");
- Assert.assertEquals("creategroups,createpages,editprofile", p2.getActions());
+ Assertions.assertEquals("creategroups,createpages,editprofile", p2.getActions());
}
/*
@@ -97,22 +97,22 @@ public class WikiPermissionTest
WikiPermission p3 = new WikiPermission("*", "createGroups");
WikiPermission p5 = new WikiPermission("*", "editPreferences");
WikiPermission p6 = new WikiPermission("*", "editProfile");
- Assert.assertTrue(p1.implies(p2));
- Assert.assertFalse(p2.implies(p1));
- Assert.assertTrue(p1.implies(p3));
- Assert.assertFalse(p3.implies(p1));
- Assert.assertTrue(p1.implies(p6));
- Assert.assertFalse(p6.implies(p1));
+ Assertions.assertTrue(p1.implies(p2));
+ Assertions.assertFalse(p2.implies(p1));
+ Assertions.assertTrue(p1.implies(p3));
+ Assertions.assertFalse(p3.implies(p1));
+ Assertions.assertTrue(p1.implies(p6));
+ Assertions.assertFalse(p6.implies(p1));
// createGroups implies createPages
- Assert.assertTrue(p3.implies(p2));
- Assert.assertFalse(p2.implies(p3));
+ Assertions.assertTrue(p3.implies(p2));
+ Assertions.assertFalse(p2.implies(p3));
// editProfile implies nothing
- Assert.assertFalse(p6.implies(p5));
- Assert.assertFalse(p6.implies(p3));
- Assert.assertFalse(p6.implies(p3));
- Assert.assertFalse(p6.implies(p1));
+ Assertions.assertFalse(p6.implies(p5));
+ Assertions.assertFalse(p6.implies(p3));
+ Assertions.assertFalse(p6.implies(p3));
+ Assertions.assertFalse(p6.implies(p1));
}
/*
@@ -127,20 +127,20 @@ public class WikiPermissionTest
WikiPermission p3 = new WikiPermission("mywiki", "createGroups");
WikiPermission p4 = new WikiPermission("urwiki", "editProfile");
WikiPermission p5 = new WikiPermission("*", "editPreferences");
- Assert.assertTrue(p1.implies(p2));
- Assert.assertFalse(p2.implies(p1));
- Assert.assertTrue(p1.implies(p3));
- Assert.assertFalse(p3.implies(p1));
- Assert.assertTrue(p1.implies(p4));
- Assert.assertFalse(p4.implies(p1));
+ Assertions.assertTrue(p1.implies(p2));
+ Assertions.assertFalse(p2.implies(p1));
+ Assertions.assertTrue(p1.implies(p3));
+ Assertions.assertFalse(p3.implies(p1));
+ Assertions.assertTrue(p1.implies(p4));
+ Assertions.assertFalse(p4.implies(p1));
// createGroups implies createPages
- Assert.assertTrue(p3.implies(p2));
- Assert.assertFalse(p2.implies(p3));
+ Assertions.assertTrue(p3.implies(p2));
+ Assertions.assertFalse(p2.implies(p3));
// editPreferences does not imply editProfile
- Assert.assertFalse(p5.implies(p4));
- Assert.assertFalse(p4.implies(p5));
+ Assertions.assertFalse(p5.implies(p4));
+ Assertions.assertFalse(p4.implies(p5));
}
/*
@@ -151,31 +151,31 @@ public class WikiPermissionTest
{
WikiPermission p1 = new WikiPermission("*", "createPages,createGroups,editProfile");
String result = "(\"org.apache.wiki.auth.permissions.WikiPermission\",\"*\",\"creategroups,createpages,editprofile\")";
- Assert.assertEquals(result, p1.toString());
+ Assertions.assertEquals(result, p1.toString());
}
@Test
public void testImpliedMask()
{
- Assert.assertEquals(3, WikiPermission.impliedMask(1));
- Assert.assertEquals(2, WikiPermission.impliedMask(2));
- Assert.assertEquals(4, WikiPermission.impliedMask(4));
+ Assertions.assertEquals(3, WikiPermission.impliedMask(1));
+ Assertions.assertEquals(2, WikiPermission.impliedMask(2));
+ Assertions.assertEquals(4, WikiPermission.impliedMask(4));
}
@Test
public void testCreateMask()
{
- Assert.assertEquals(1, WikiPermission.createMask("createGroups"));
- Assert.assertEquals(2, WikiPermission.createMask("createPages"));
- Assert.assertEquals(3, WikiPermission.createMask("createGroups,createPages"));
- Assert.assertEquals(4, WikiPermission.createMask("editPreferences"));
- Assert.assertEquals(5, WikiPermission.createMask("createGroups,editPreferences"));
- Assert.assertEquals(6, WikiPermission.createMask("createPages,editPreferences"));
- Assert.assertEquals(7, WikiPermission.createMask("createGroups,createPages,editPreferences"));
- Assert.assertEquals(8, WikiPermission.createMask("editProfile"));
- Assert.assertEquals(9, WikiPermission.createMask("createGroups,editProfile"));
- Assert.assertEquals(16, WikiPermission.createMask("login"));
- Assert.assertEquals(24, WikiPermission.createMask("login,editProfile"));
+ Assertions.assertEquals(1, WikiPermission.createMask("createGroups"));
+ Assertions.assertEquals(2, WikiPermission.createMask("createPages"));
+ Assertions.assertEquals(3, WikiPermission.createMask("createGroups,createPages"));
+ Assertions.assertEquals(4, WikiPermission.createMask("editPreferences"));
+ Assertions.assertEquals(5, WikiPermission.createMask("createGroups,editPreferences"));
+ Assertions.assertEquals(6, WikiPermission.createMask("createPages,editPreferences"));
+ Assertions.assertEquals(7, WikiPermission.createMask("createGroups,createPages,editPreferences"));
+ Assertions.assertEquals(8, WikiPermission.createMask("editProfile"));
+ Assertions.assertEquals(9, WikiPermission.createMask("createGroups,editProfile"));
+ Assertions.assertEquals(16, WikiPermission.createMask("login"));
+ Assertions.assertEquals(24, WikiPermission.createMask("login,editProfile"));
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/user/JDBCUserDatabaseTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/user/JDBCUserDatabaseTest.java
index 7f48565..1a7c6c9 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/user/JDBCUserDatabaseTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/user/JDBCUserDatabaseTest.java
@@ -38,10 +38,10 @@ import org.apache.wiki.TestJNDIContext;
import org.apache.wiki.auth.NoSuchPrincipalException;
import org.apache.wiki.auth.WikiSecurityException;
import org.apache.wiki.util.CryptoUtil;
-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;
/**
*/
@@ -81,7 +81,7 @@ public class JDBCUserDatabaseTest
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
m_hu.setUp();
@@ -125,12 +125,12 @@ public class JDBCUserDatabaseTest
}
catch( SQLException e )
{
- Assert.fail("Looks like your database could not be connected to - "+
+ Assertions.fail("Looks like your database could not be connected to - "+
"please make sure that you have started your database, exception: " + e.getMessage());
}
}
- @After
+ @AfterEach
public void tearDown() throws Exception
{
m_hu.tearDown();
@@ -153,12 +153,12 @@ public class JDBCUserDatabaseTest
// Make sure the profile saved successfully
profile = m_db.findByLoginName( loginName );
- Assert.assertEquals( loginName, profile.getLoginName() );
- Assert.assertEquals( oldUserCount+1, m_db.getWikiNames().length );
+ Assertions.assertEquals( loginName, profile.getLoginName() );
+ Assertions.assertEquals( oldUserCount+1, m_db.getWikiNames().length );
// Now delete the profile; should be back to old count
m_db.deleteByLoginName( loginName );
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
}
@Test
@@ -167,11 +167,11 @@ public class JDBCUserDatabaseTest
UserProfile profile = m_db.findByEmail( "janne@ecyrd.com" );
Map<String,Serializable> attributes = profile.getAttributes();
- Assert.assertEquals( 2, attributes.size() );
- Assert.assertTrue( attributes.containsKey( "attribute1" ) );
- Assert.assertTrue( attributes.containsKey( "attribute2" ) );
- Assert.assertEquals( "some random value", attributes.get( "attribute1" ) );
- Assert.assertEquals( "another value", attributes.get( "attribute2" ) );
+ Assertions.assertEquals( 2, attributes.size() );
+ Assertions.assertTrue( attributes.containsKey( "attribute1" ) );
+ Assertions.assertTrue( attributes.containsKey( "attribute2" ) );
+ Assertions.assertEquals( "some random value", attributes.get( "attribute1" ) );
+ Assertions.assertEquals( "another value", attributes.get( "attribute2" ) );
// Change attribute 1, and add another one
attributes.put( "attribute1", "replacement value" );
@@ -181,13 +181,13 @@ public class JDBCUserDatabaseTest
// Retrieve the profile again and make sure our values got saved
profile = m_db.findByEmail( "janne@ecyrd.com" );
attributes = profile.getAttributes();
- Assert.assertEquals( 3, attributes.size() );
- Assert.assertTrue( attributes.containsKey( "attribute1" ) );
- Assert.assertTrue( attributes.containsKey( "attribute2" ) );
- Assert.assertTrue( attributes.containsKey( "attribute the third" ) );
- Assert.assertEquals( "replacement value", attributes.get( "attribute1" ) );
- Assert.assertEquals( "another value", attributes.get( "attribute2" ) );
- Assert.assertEquals( "some value", attributes.get( "attribute the third" ) );
+ Assertions.assertEquals( 3, attributes.size() );
+ Assertions.assertTrue( attributes.containsKey( "attribute1" ) );
+ Assertions.assertTrue( attributes.containsKey( "attribute2" ) );
+ Assertions.assertTrue( attributes.containsKey( "attribute the third" ) );
+ Assertions.assertEquals( "replacement value", attributes.get( "attribute1" ) );
+ Assertions.assertEquals( "another value", attributes.get( "attribute2" ) );
+ Assertions.assertEquals( "some value", attributes.get( "attribute the third" ) );
// Restore the original attributes and re-save
attributes.put( "attribute1", "some random value" );
@@ -201,28 +201,28 @@ public class JDBCUserDatabaseTest
try
{
UserProfile profile = m_db.findByEmail( "janne@ecyrd.com" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNull( profile.getLastModified() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNull( profile.getLastModified() );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try
{
m_db.findByEmail( "foo@bar.org" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -232,28 +232,28 @@ public class JDBCUserDatabaseTest
try
{
UserProfile profile = m_db.findByFullName( "Janne Jalkanen" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNull( profile.getLastModified() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNull( profile.getLastModified() );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try
{
m_db.findByEmail( "foo@bar.org" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -263,28 +263,28 @@ public class JDBCUserDatabaseTest
try
{
UserProfile profile = m_db.findByUid( "-7739839977499061014" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNull( profile.getLastModified() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNull( profile.getLastModified() );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try
{
m_db.findByEmail( "foo@bar.org" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -294,28 +294,28 @@ public class JDBCUserDatabaseTest
try
{
UserProfile profile = m_db.findByWikiName( "JanneJalkanen" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNull( profile.getLastModified() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNull( profile.getLastModified() );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try
{
m_db.findByEmail( "foo" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -325,28 +325,28 @@ public class JDBCUserDatabaseTest
try
{
UserProfile profile = m_db.findByLoginName( "janne" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNull( profile.getLastModified() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SHA}457b08e825da547c3b77fbc1ff906a1d00a7daee", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNull( profile.getLastModified() );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try
{
m_db.findByEmail( "FooBar" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -354,17 +354,17 @@ public class JDBCUserDatabaseTest
public void testGetWikiName() throws WikiSecurityException
{
Principal[] principals = m_db.getWikiNames();
- Assert.assertEquals( 1, principals.length );
+ Assertions.assertEquals( 1, principals.length );
}
@Test
public void testRename() throws Exception
{
- // Try renaming a non-existent profile; it should Assert.fail
+ // Try renaming a non-existent profile; it should Assertions.fail
try
{
m_db.rename( "nonexistentname", "renameduser" );
- Assert.fail( "Should not have allowed rename..." );
+ Assertions.fail( "Should not have allowed rename..." );
}
catch ( NoSuchPrincipalException e )
{
@@ -379,13 +379,13 @@ public class JDBCUserDatabaseTest
profile.setPassword( "password" );
m_db.save( profile );
profile = m_db.findByLoginName( "olduser" );
- Assert.assertNotNull( profile );
+ Assertions.assertNotNull( profile );
- // Try renaming to a login name that's already taken; it should Assert.fail
+ // Try renaming to a login name that's already taken; it should Assertions.fail
try
{
m_db.rename( "olduser", "janne" );
- Assert.fail( "Should not have allowed rename..." );
+ Assertions.fail( "Should not have allowed rename..." );
}
catch ( DuplicateUserException e )
{
@@ -399,7 +399,7 @@ public class JDBCUserDatabaseTest
try
{
profile = m_db.findByLoginName( "olduser" );
- Assert.fail( "Old user was found, but it shouldn't have been." );
+ Assertions.fail( "Old user was found, but it shouldn't have been." );
}
catch ( NoSuchPrincipalException e )
{
@@ -408,10 +408,10 @@ public class JDBCUserDatabaseTest
// The new profile should be found, and its properties should match the old ones
profile = m_db.findByLoginName( "renameduser" );
- Assert.assertEquals( "renamed@mailinator.com", profile.getEmail() );
- Assert.assertEquals( "Renamed User", profile.getFullname() );
- Assert.assertEquals( "renameduser", profile.getLoginName() );
- Assert.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
+ Assertions.assertEquals( "renamed@mailinator.com", profile.getEmail() );
+ Assertions.assertEquals( "Renamed User", profile.getFullname() );
+ Assertions.assertEquals( "renameduser", profile.getLoginName() );
+ Assertions.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
// Delete the user
m_db.deleteByLoginName( "renameduser" );
@@ -430,14 +430,14 @@ public class JDBCUserDatabaseTest
profile.setPassword( "password" );
m_db.save( profile );
profile = m_db.findByEmail( "jspwiki.tests@mailinator.com" );
- Assert.assertEquals( "jspwiki.tests@mailinator.com", profile.getEmail() );
- Assert.assertEquals( "Test User", profile.getFullname() );
- Assert.assertEquals( "user", profile.getLoginName() );
- Assert.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
- Assert.assertEquals( "TestUser", profile.getWikiName() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNotNull( profile.getLastModified() );
- Assert.assertNotSame( profile.getCreated(), profile.getLastModified() );
+ Assertions.assertEquals( "jspwiki.tests@mailinator.com", profile.getEmail() );
+ Assertions.assertEquals( "Test User", profile.getFullname() );
+ Assertions.assertEquals( "user", profile.getLoginName() );
+ Assertions.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
+ Assertions.assertEquals( "TestUser", profile.getWikiName() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNotNull( profile.getLastModified() );
+ Assertions.assertNotSame( profile.getCreated(), profile.getLastModified() );
// Create new user
profile = m_db.newProfile();
@@ -447,36 +447,36 @@ public class JDBCUserDatabaseTest
profile.setPassword( "password" );
m_db.save( profile );
profile = m_db.findByEmail( "jspwiki.tests2@mailinator.com" );
- Assert.assertEquals( "jspwiki.tests2@mailinator.com", profile.getEmail() );
- Assert.assertEquals( "Test User 2", profile.getFullname() );
- Assert.assertEquals( "user2", profile.getLoginName() );
- Assert.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
- Assert.assertEquals( "TestUser2", profile.getWikiName() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNotNull( profile.getLastModified() );
- Assert.assertEquals( profile.getCreated(), profile.getLastModified() );
+ Assertions.assertEquals( "jspwiki.tests2@mailinator.com", profile.getEmail() );
+ Assertions.assertEquals( "Test User 2", profile.getFullname() );
+ Assertions.assertEquals( "user2", profile.getLoginName() );
+ Assertions.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
+ Assertions.assertEquals( "TestUser2", profile.getWikiName() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNotNull( profile.getLastModified() );
+ Assertions.assertEquals( profile.getCreated(), profile.getLastModified() );
// Make sure we can find it by uid
String uid = profile.getUid();
- Assert.assertNotNull( m_db.findByUid( uid ) );
+ Assertions.assertNotNull( m_db.findByUid( uid ) );
}
catch( NoSuchPrincipalException e )
{
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
catch( WikiSecurityException e )
{
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
@Test
public void testValidatePassword()
{
- Assert.assertFalse( m_db.validatePassword( "janne", "test" ) );
- Assert.assertTrue( m_db.validatePassword( "janne", "myP@5sw0rd" ) );
- Assert.assertTrue( m_db.validatePassword( "user", "password" ) );
+ Assertions.assertFalse( m_db.validatePassword( "janne", "test" ) );
+ Assertions.assertTrue( m_db.validatePassword( "janne", "myP@5sw0rd" ) );
+ Assertions.assertTrue( m_db.validatePassword( "user", "password" ) );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/user/UserProfileTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/user/UserProfileTest.java
index b9ea104..9bba029 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/user/UserProfileTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/user/UserProfileTest.java
@@ -23,9 +23,9 @@ import java.util.Properties;
import org.apache.log4j.PropertyConfigurator;
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiEngine;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Tests the DefaultUserProfile class.
@@ -34,7 +34,7 @@ public class UserProfileTest
{
private UserDatabase m_db;
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -48,56 +48,56 @@ public class UserProfileTest
public void testSetAttribute()
{
UserProfile p = m_db.newProfile();
- Assert.assertEquals( 0, p.getAttributes().size() );
+ Assertions.assertEquals( 0, p.getAttributes().size() );
p.getAttributes().put( "MyAttribute", "some arbitrary value." );
- Assert.assertEquals( 1, p.getAttributes().size() );
+ Assertions.assertEquals( 1, p.getAttributes().size() );
p.getAttributes().put( "YourAttribute", "another arbitrary value." );
- Assert.assertEquals( 2, p.getAttributes().size() );
- Assert.assertTrue( p.getAttributes().containsKey( "MyAttribute" ) );
- Assert.assertTrue( p.getAttributes().containsKey( "YourAttribute" ) );
+ Assertions.assertEquals( 2, p.getAttributes().size() );
+ Assertions.assertTrue( p.getAttributes().containsKey( "MyAttribute" ) );
+ Assertions.assertTrue( p.getAttributes().containsKey( "YourAttribute" ) );
p.getAttributes().remove( "MyAttribute" );
- Assert.assertEquals( 1, p.getAttributes().size() );
+ Assertions.assertEquals( 1, p.getAttributes().size() );
}
@Test
public void testSetLockExpiry()
{
UserProfile p = m_db.newProfile();
- Assert.assertNull( p.getLockExpiry() );
- Assert.assertFalse( p.isLocked() );
+ Assertions.assertNull( p.getLockExpiry() );
+ Assertions.assertFalse( p.isLocked() );
// Set a lock expiry for 1 second in the past; should cause lock to report as null
p.setLockExpiry( new Date( System.currentTimeMillis() - 1000 ) );
- Assert.assertNull( p.getLockExpiry() );
- Assert.assertFalse( p.isLocked() );
+ Assertions.assertNull( p.getLockExpiry() );
+ Assertions.assertFalse( p.isLocked() );
// Set a lock expiry for 1 second in the past; should say it's not locked
p.setLockExpiry( new Date( System.currentTimeMillis() - 1000 ) );
- Assert.assertFalse( p.isLocked() );
- Assert.assertNull( p.getLockExpiry() );
+ Assertions.assertFalse( p.isLocked() );
+ Assertions.assertNull( p.getLockExpiry() );
// Now set a lock for 100 seconds in the future; lock should be reported correctly
Date future = new Date( System.currentTimeMillis() + 100000 );
p.setLockExpiry( future );
- Assert.assertTrue( p.isLocked() );
- Assert.assertEquals( future, p.getLockExpiry() );
+ Assertions.assertTrue( p.isLocked() );
+ Assertions.assertEquals( future, p.getLockExpiry() );
// Clear the lock
p.setLockExpiry( null );
- Assert.assertFalse( p.isLocked() );
- Assert.assertNull( p.getLockExpiry() );
+ Assertions.assertFalse( p.isLocked() );
+ Assertions.assertNull( p.getLockExpiry() );
}
@Test
public void testSetUid()
{
UserProfile p = m_db.newProfile();
- Assert.assertNotSame( "1234567890", p.getUid() );
+ Assertions.assertNotSame( "1234567890", p.getUid() );
p.setUid( "1234567890" );
- Assert.assertEquals( "1234567890", p.getUid() );
+ Assertions.assertEquals( "1234567890", p.getUid() );
}
@Test
@@ -109,7 +109,7 @@ public class UserProfileTest
p.setFullname("Alice");
p2.setFullname("Bob");
- Assert.assertFalse( p.equals( p2 ) );
+ Assertions.assertFalse( p.equals( p2 ) );
}
@Test
@@ -121,7 +121,7 @@ public class UserProfileTest
p.setFullname("Alice");
p2.setFullname("Alice");
- Assert.assertTrue( p.equals( p2 ) );
+ Assertions.assertTrue( p.equals( p2 ) );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java
index 4a6f3b1..5f14a99 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java
@@ -31,9 +31,9 @@ import org.apache.wiki.auth.Users;
import org.apache.wiki.auth.WikiPrincipal;
import org.apache.wiki.auth.WikiSecurityException;
import org.apache.wiki.util.CryptoUtil;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class XMLUserDatabaseTest {
@@ -43,7 +43,7 @@ public class XMLUserDatabaseTest {
/**
*
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
props.put( XMLUserDatabase.PROP_USERDATABASE, "target/test-classes/userdatabase.xml" );
@@ -68,12 +68,12 @@ public class XMLUserDatabaseTest {
// Make sure the profile saved successfully
profile = m_db.findByLoginName( loginName );
- Assert.assertEquals( loginName, profile.getLoginName() );
- Assert.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
+ Assertions.assertEquals( loginName, profile.getLoginName() );
+ Assertions.assertEquals( oldUserCount + 1, m_db.getWikiNames().length );
// Now delete the profile; should be back to old count
m_db.deleteByLoginName( loginName );
- Assert.assertEquals( oldUserCount, m_db.getWikiNames().length );
+ Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length );
}
@Test
@@ -81,11 +81,11 @@ public class XMLUserDatabaseTest {
UserProfile profile = m_db.findByEmail( "janne@ecyrd.com" );
Map< String, Serializable > attributes = profile.getAttributes();
- Assert.assertEquals( 2, attributes.size() );
- Assert.assertTrue( attributes.containsKey( "attribute1" ) );
- Assert.assertTrue( attributes.containsKey( "attribute2" ) );
- Assert.assertEquals( "some random value", attributes.get( "attribute1" ) );
- Assert.assertEquals( "another value", attributes.get( "attribute2" ) );
+ Assertions.assertEquals( 2, attributes.size() );
+ Assertions.assertTrue( attributes.containsKey( "attribute1" ) );
+ Assertions.assertTrue( attributes.containsKey( "attribute2" ) );
+ Assertions.assertEquals( "some random value", attributes.get( "attribute1" ) );
+ Assertions.assertEquals( "another value", attributes.get( "attribute2" ) );
// Change attribute 1, and add another one
attributes.put( "attribute1", "replacement value" );
@@ -95,13 +95,13 @@ public class XMLUserDatabaseTest {
// Retrieve the profile again and make sure our values got saved
profile = m_db.findByEmail( "janne@ecyrd.com" );
attributes = profile.getAttributes();
- Assert.assertEquals( 3, attributes.size() );
- Assert.assertTrue( attributes.containsKey( "attribute1" ) );
- Assert.assertTrue( attributes.containsKey( "attribute2" ) );
- Assert.assertTrue( attributes.containsKey( "attribute the third" ) );
- Assert.assertEquals( "replacement value", attributes.get( "attribute1" ) );
- Assert.assertEquals( "another value", attributes.get( "attribute2" ) );
- Assert.assertEquals( "some value", attributes.get( "attribute the third" ) );
+ Assertions.assertEquals( 3, attributes.size() );
+ Assertions.assertTrue( attributes.containsKey( "attribute1" ) );
+ Assertions.assertTrue( attributes.containsKey( "attribute2" ) );
+ Assertions.assertTrue( attributes.containsKey( "attribute the third" ) );
+ Assertions.assertEquals( "replacement value", attributes.get( "attribute1" ) );
+ Assertions.assertEquals( "another value", attributes.get( "attribute2" ) );
+ Assertions.assertEquals( "some value", attributes.get( "attribute the third" ) );
// Restore the original attributes and re-save
attributes.put( "attribute1", "some random value" );
@@ -113,21 +113,21 @@ public class XMLUserDatabaseTest {
public void testFindByEmail() {
try {
UserProfile profile = m_db.findByEmail( "janne@ecyrd.com" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try {
m_db.findByEmail( "foo@bar.org" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -135,23 +135,23 @@ public class XMLUserDatabaseTest {
public void testFindByFullName() {
try {
UserProfile profile = m_db.findByFullName( "Janne Jalkanen" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNotNull( profile.getLastModified() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNotNull( profile.getLastModified() );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try {
m_db.findByEmail( "foo@bar.org" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -159,23 +159,23 @@ public class XMLUserDatabaseTest {
public void testFindByUid() {
try {
UserProfile profile = m_db.findByUid( "-7739839977499061014" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
- Assert.assertNotNull( profile.getCreated() );
- Assert.assertNotNull( profile.getLastModified() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertNotNull( profile.getCreated() );
+ Assertions.assertNotNull( profile.getLastModified() );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try {
m_db.findByEmail( "foo@bar.org" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -183,21 +183,21 @@ public class XMLUserDatabaseTest {
public void testFindByWikiName() {
try {
UserProfile profile = m_db.findByWikiName( "JanneJalkanen" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try {
m_db.findByEmail( "foo" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -205,21 +205,21 @@ public class XMLUserDatabaseTest {
public void testFindByLoginName() {
try {
UserProfile profile = m_db.findByLoginName( "janne" );
- Assert.assertEquals( "-7739839977499061014", profile.getUid() );
- Assert.assertEquals( "janne", profile.getLoginName() );
- Assert.assertEquals( "Janne Jalkanen", profile.getFullname() );
- Assert.assertEquals( "JanneJalkanen", profile.getWikiName() );
- Assert.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
- Assert.assertEquals( "janne@ecyrd.com", profile.getEmail() );
+ Assertions.assertEquals( "-7739839977499061014", profile.getUid() );
+ Assertions.assertEquals( "janne", profile.getLoginName() );
+ Assertions.assertEquals( "Janne Jalkanen", profile.getFullname() );
+ Assertions.assertEquals( "JanneJalkanen", profile.getWikiName() );
+ Assertions.assertEquals( "{SSHA}1WFv9OV11pD5IySgVH3sFa2VlCyYjbLrcVT/qw==", profile.getPassword() );
+ Assertions.assertEquals( "janne@ecyrd.com", profile.getEmail() );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
try {
m_db.findByEmail( "FooBar" );
// We should never get here
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( true );
+ Assertions.assertTrue( true );
}
}
@@ -227,23 +227,23 @@ public class XMLUserDatabaseTest {
public void testGetWikiNames() throws WikiSecurityException {
// There are 8 test users in the database
Principal[] p = m_db.getWikiNames();
- Assert.assertEquals( 8, p.length );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "", WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "Administrator", WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.ALICE, WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.BOB, WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.CHARLIE, WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "FredFlintstone", WikiPrincipal.WIKI_NAME ) ) );
- Assert.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.BIFF, WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertEquals( 8, p.length );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "Administrator", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.ALICE, WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.BOB, WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.CHARLIE, WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "FredFlintstone", WikiPrincipal.WIKI_NAME ) ) );
+ Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.BIFF, WikiPrincipal.WIKI_NAME ) ) );
}
@Test
public void testRename() throws Exception {
- // Try renaming a non-existent profile; it should Assert.fail
+ // Try renaming a non-existent profile; it should Assertions.fail
try {
m_db.rename( "nonexistentname", "renameduser" );
- Assert.fail( "Should not have allowed rename..." );
+ Assertions.fail( "Should not have allowed rename..." );
} catch( NoSuchPrincipalException e ) {
// Cool; that's what we expect
}
@@ -256,12 +256,12 @@ public class XMLUserDatabaseTest {
profile.setPassword( "password" );
m_db.save( profile );
profile = m_db.findByLoginName( "olduser" );
- Assert.assertNotNull( profile );
+ Assertions.assertNotNull( profile );
- // Try renaming to a login name that's already taken; it should Assert.fail
+ // Try renaming to a login name that's already taken; it should Assertions.fail
try {
m_db.rename( "olduser", "janne" );
- Assert.fail( "Should not have allowed rename..." );
+ Assertions.fail( "Should not have allowed rename..." );
} catch( DuplicateUserException e ) {
// Cool; that's what we expect
}
@@ -272,17 +272,17 @@ public class XMLUserDatabaseTest {
// The old user shouldn't be found
try {
profile = m_db.findByLoginName( "olduser" );
- Assert.fail( "Old user was found, but it shouldn't have been." );
+ Assertions.fail( "Old user was found, but it shouldn't have been." );
} catch( NoSuchPrincipalException e ) {
// Cool, it's gone
}
// The new profile should be found, and its properties should match the old ones
profile = m_db.findByLoginName( "renameduser" );
- Assert.assertEquals( "renamed@mailinator.com", profile.getEmail() );
- Assert.assertEquals( "Renamed User", profile.getFullname() );
- Assert.assertEquals( "renameduser", profile.getLoginName() );
- Assert.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
+ Assertions.assertEquals( "renamed@mailinator.com", profile.getEmail() );
+ Assertions.assertEquals( "Renamed User", profile.getFullname() );
+ Assertions.assertEquals( "renameduser", profile.getLoginName() );
+ Assertions.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
// Delete the user
m_db.deleteByLoginName( "renameduser" );
@@ -297,24 +297,24 @@ public class XMLUserDatabaseTest {
profile.setPassword( "password" );
m_db.save( profile );
profile = m_db.findByEmail( "jspwiki.tests@mailinator.com" );
- Assert.assertEquals( "jspwiki.tests@mailinator.com", profile.getEmail() );
- Assert.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
+ Assertions.assertEquals( "jspwiki.tests@mailinator.com", profile.getEmail() );
+ Assertions.assertTrue( CryptoUtil.verifySaltedPassword( "password".getBytes(), profile.getPassword() ) );
// Make sure we can find it by uid
String uid = profile.getUid();
- Assert.assertNotNull( m_db.findByUid( uid ) );
+ Assertions.assertNotNull( m_db.findByUid( uid ) );
} catch( NoSuchPrincipalException e ) {
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
} catch( WikiSecurityException e ) {
- Assert.assertTrue( false );
+ Assertions.assertTrue( false );
}
}
@Test
public void testValidatePassword() {
- Assert.assertFalse( m_db.validatePassword( "janne", "test" ) );
- Assert.assertTrue( m_db.validatePassword( "janne", "myP@5sw0rd" ) );
- Assert.assertTrue( m_db.validatePassword( "user", "password" ) );
+ Assertions.assertFalse( m_db.validatePassword( "janne", "test" ) );
+ Assertions.assertTrue( m_db.validatePassword( "janne", "myP@5sw0rd" ) );
+ Assertions.assertTrue( m_db.validatePassword( "user", "password" ) );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/content/PageRenamerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/content/PageRenamerTest.java
index 9984d6c..799d09f 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/content/PageRenamerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/content/PageRenamerTest.java
@@ -17,14 +17,14 @@
under the License.
*/
package org.apache.wiki.content;
-import org.junit.Before;
-import org.junit.After;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
import java.util.Collection;
import java.util.Properties;
-import org.junit.Test;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
import net.sf.ehcache.CacheManager;
import org.apache.wiki.TestEngine;
@@ -39,7 +39,7 @@ public class PageRenamerTest
{
TestEngine m_engine;
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
Properties props = TestEngine.getTestProperties();
@@ -49,7 +49,7 @@ public class PageRenamerTest
m_engine = new TestEngine(props);
}
- @After
+ @AfterEach
public void tearDown() throws Exception
{
m_engine.deleteTestPage("TestPage");
@@ -89,15 +89,15 @@ public class PageRenamerTest
WikiPage newpage = m_engine.getPage("FooTest");
- Assert.assertNotNull( "no new page", newpage );
- Assert.assertNull( "old page not gone", m_engine.getPage("TestPage") );
+ Assertions.assertNotNull( newpage, "no new page" );
+ Assertions.assertNull( m_engine.getPage("TestPage"), "old page not gone" );
// Refmgr
Collection< String > refs = m_engine.getReferenceManager().findCreated();
- Assert.assertTrue( "FooTest does not exist", refs.contains("FooTest") );
- Assert.assertFalse( "TestPage exists", refs.contains("TestPage") );
- Assert.assertEquals( "wrong list size", refCount+1, refs.size() );
+ Assertions.assertTrue( refs.contains("FooTest"), "FooTest does not exist" );
+ Assertions.assertFalse( refs.contains("TestPage"), "TestPage exists" );
+ Assertions.assertEquals( refCount+1, refs.size(), "wrong list size" );
}
@Test
@@ -115,15 +115,15 @@ public class PageRenamerTest
String data = m_engine.getPureText("TestPage2", WikiProvider.LATEST_VERSION);
- Assert.assertEquals( "no rename", "[FooTest]", data.trim() );
+ Assertions.assertEquals( "[FooTest]", data.trim(), "no rename" );
Collection< String > refs = m_engine.getReferenceManager().findReferrers("TestPage");
- Assert.assertNull( "oldpage", refs );
+ Assertions.assertNull( refs, "oldpage" );
refs = m_engine.getReferenceManager().findReferrers( "FooTest" );
- Assert.assertEquals( "new size", 1, refs.size() );
- Assert.assertEquals( "wrong ref", "TestPage2", (String)refs.iterator().next() );
+ Assertions.assertEquals( 1, refs.size(), "new size" );
+ Assertions.assertEquals( "TestPage2", refs.iterator().next(), "wrong ref" );
}
@Test
@@ -141,14 +141,14 @@ public class PageRenamerTest
String data = m_engine.getPureText("TestPage2", WikiProvider.LATEST_VERSION);
- Assert.assertEquals( "no rename", "FooTest", data.trim() );
+ Assertions.assertEquals( "FooTest", data.trim(), "no rename" );
Collection< String > refs = m_engine.getReferenceManager().findReferrers("TestPage");
- Assert.assertNull( "oldpage", refs );
+ Assertions.assertNull( refs, "oldpage" );
refs = m_engine.getReferenceManager().findReferrers( "FooTest" );
- Assert.assertEquals( "new size", 1, refs.size() );
- Assert.assertEquals( "wrong ref", "TestPage2", (String)refs.iterator().next() );
+ Assertions.assertEquals( 1, refs.size(), "new size" );
+ Assertions.assertEquals( "TestPage2", refs.iterator().next(), "wrong ref" );
}
@Test
@@ -166,14 +166,14 @@ public class PageRenamerTest
String data = m_engine.getPureText("TestPage2", WikiProvider.LATEST_VERSION);
- Assert.assertEquals( "no rename", "[FooTest#heading1]", data.trim() );
+ Assertions.assertEquals( "[FooTest#heading1]", data.trim(), "no rename" );
Collection< String > refs = m_engine.getReferenceManager().findReferrers("TestPage");
- Assert.assertNull( "oldpage", refs );
+ Assertions.assertNull( refs, "oldpage" );
refs = m_engine.getReferenceManager().findReferrers( "FooTest" );
- Assert.assertEquals( "new size", 1, refs.size() );
- Assert.assertEquals( "wrong ref", "TestPage2", (String)refs.iterator().next() );
+ Assertions.assertEquals( 1, refs.size(), "new size" );
+ Assertions.assertEquals( "TestPage2", refs.iterator().next(), "wrong ref" );
}
@Test
@@ -191,17 +191,17 @@ public class PageRenamerTest
String data = m_engine.getPureText("TestPage2", WikiProvider.LATEST_VERSION);
- Assert.assertEquals( "no rename",
- "[FooTest] [FooTest] [linktext|FooTest] FooTest [linktext|FooTest] [FooTest#Anchor] [FooTest] FooTest [FooTest]",
- data.trim() );
+ Assertions.assertEquals( "[FooTest] [FooTest] [linktext|FooTest] FooTest [linktext|FooTest] [FooTest#Anchor] [FooTest] FooTest [FooTest]",
+ data.trim(),
+ "no rename" );
Collection< String > refs = m_engine.getReferenceManager().findReferrers("TestPage");
- Assert.assertNull( "oldpage", refs );
+ Assertions.assertNull( refs, "oldpage" );
refs = m_engine.getReferenceManager().findReferrers( "FooTest" );
- Assert.assertEquals( "new size", 1, refs.size() );
- Assert.assertEquals( "wrong ref", "TestPage2", (String)refs.iterator().next() );
+ Assertions.assertEquals( 1, refs.size(), "new size" );
+ Assertions.assertEquals( "TestPage2", refs.iterator().next(), "wrong ref" );
}
@Test
@@ -219,7 +219,7 @@ public class PageRenamerTest
String data = m_engine.getPureText("TestPage2", WikiProvider.LATEST_VERSION );
- Assert.assertEquals( "wrong data", "[TestPage] [TestPage#anchor] test Test [TestPage] [link|TestPage] [link|TestPage]", data.trim() );
+ Assertions.assertEquals( "[TestPage] [TestPage#anchor] test Test [TestPage] [link|TestPage] [link|TestPage]", data.trim(), "wrong data" );
}
@Test
@@ -239,29 +239,27 @@ public class PageRenamerTest
String data = m_engine.getPureText("TestPage2", WikiProvider.LATEST_VERSION);
- Assert.assertEquals( "no rename",
- "[FooTest/foo.txt] [linktext|FooTest/bar.jpg]",
- data.trim() );
+ Assertions.assertEquals( "[FooTest/foo.txt] [linktext|FooTest/bar.jpg]", data.trim(), "no rename" );
Attachment att = m_engine.getAttachmentManager().getAttachmentInfo("FooTest/foo.txt");
- Assert.assertNotNull("footext",att);
+ Assertions.assertNotNull( att, "footext" );
att = m_engine.getAttachmentManager().getAttachmentInfo("FooTest/bar.jpg");
- Assert.assertNotNull("barjpg",att);
+ Assertions.assertNotNull( att, "barjpg" );
att = m_engine.getAttachmentManager().getAttachmentInfo("TestPage/bar.jpg");
- Assert.assertNull("testpage/bar.jpg exists",att);
+ Assertions.assertNull( att, "testpage/bar.jpg exists" );
att = m_engine.getAttachmentManager().getAttachmentInfo("TestPage/foo.txt");
- Assert.assertNull("testpage/foo.txt exists",att);
+ Assertions.assertNull( att, "testpage/foo.txt exists" );
Collection< String > refs = m_engine.getReferenceManager().findReferrers("TestPage/bar.jpg");
- Assert.assertNull( "oldpage", refs );
+ Assertions.assertNull( refs, "oldpage" );
refs = m_engine.getReferenceManager().findReferrers( "FooTest/bar.jpg" );
- Assert.assertEquals( "new size", 1, refs.size() );
- Assert.assertEquals( "wrong ref", "TestPage2", (String)refs.iterator().next() );
+ Assertions.assertEquals( 1, refs.size(), "new size" );
+ Assertions.assertEquals( "TestPage2", refs.iterator().next(), "wrong ref" );
}
@Test
@@ -273,9 +271,9 @@ public class PageRenamerTest
WikiPage p = m_engine.getPage( "FooTest" );
- Assert.assertNotNull( "no page", p );
+ Assertions.assertNotNull( p, "no page" );
- Assert.assertEquals("[FooTest]", m_engine.getText("FooTest").trim() );
+ Assertions.assertEquals("[FooTest]", m_engine.getText("FooTest").trim() );
}
@Test
@@ -288,10 +286,10 @@ public class PageRenamerTest
WikiPage p = m_engine.getPage( "FooTest" );
- Assert.assertNotNull( "no page", p );
+ Assertions.assertNotNull( p, "no page" );
// Should be no change
- Assert.assertEquals("[TestPage|]", m_engine.getText("TestPage2").trim() );
+ Assertions.assertEquals("[TestPage|]", m_engine.getText("TestPage2").trim() );
}
@Test
@@ -305,9 +303,9 @@ public class PageRenamerTest
p = m_engine.getPage( "FooTest" );
- Assert.assertNotNull( "no page", p );
+ Assertions.assertNotNull( p, "no page" );
- Assert.assertEquals("[|FooTest]", m_engine.getText("TestPage2").trim() );
+ Assertions.assertEquals("[|FooTest]", m_engine.getText("TestPage2").trim() );
}
private void rename( String src, String dst ) throws WikiException
@@ -337,7 +335,7 @@ public class PageRenamerTest
rename( "Cdauth", "CdauthNew" );
- Assert.assertEquals( dst, m_engine.getText("TestPage").trim() );
+ Assertions.assertEquals( dst, m_engine.getText("TestPage").trim() );
}
@Test
@@ -350,7 +348,7 @@ public class PageRenamerTest
rename ("TestPage2", "Test");
- Assert.assertEquals( "[Link to Test|Test]", m_engine.getText( "TestPage" ).trim() );
+ Assertions.assertEquals( "[Link to Test|Test]", m_engine.getText( "TestPage" ).trim() );
}
@Test
@@ -363,14 +361,14 @@ public class PageRenamerTest
rename ("TestPage2", "Test");
- Assert.assertEquals( "[Link to Test|Test|target='_new']", m_engine.getText( "TestPage" ).trim() );
+ Assertions.assertEquals( "[Link to Test|Test|target='_new']", m_engine.getText( "TestPage" ).trim() );
}
@Test
public void testBug85_case1() throws Exception
{
// renaming a non-existing page
- // This Assert.fails under 2.5.116, cfr. with http://bugs.jspwiki.org/show_bug.cgi?id=85
+ // This Assertions.fails under 2.5.116, cfr. with http://bugs.jspwiki.org/show_bug.cgi?id=85
// m_engine.saveText( "TestPage", "blablahblahbla" );
try
{
@@ -381,7 +379,7 @@ public class PageRenamerTest
{
npe.printStackTrace();
System.out.println("NPE: Bug 85 caught?");
- Assert.fail();
+ Assertions.fail( npe );
}
catch( WikiException e )
{
@@ -395,7 +393,7 @@ public class PageRenamerTest
try
{
// renaming a non-existing page, but we call m_engine.saveText() before renaming
- // this does not Assert.fail under 2.5.116
+ // this does not Assertions.fail under 2.5.116
m_engine.saveText( "TestPage1234", "blablahblahbla" );
rename("TestPage1234", "Main8887");
rename("Main8887", "TestPage1234");
@@ -404,7 +402,7 @@ public class PageRenamerTest
{
npe.printStackTrace();
System.out.println("NPE: Bug 85 caught?");
- Assert.fail();
+ Assertions.fail( npe );
}
}
@@ -414,7 +412,7 @@ public class PageRenamerTest
try
{
// renaming an existing page
- // this does not Assert.fail under 2.5.116
+ // this does not Assertions.fail under 2.5.116
// m_engine.saveText( "Main", "blablahblahbla" );
rename("Main", "Main8887");
rename("Main8887", "Main");
@@ -423,7 +421,7 @@ public class PageRenamerTest
{
npe.printStackTrace();
System.out.println("NPE: Bug 85 caught?");
- Assert.fail();
+ Assertions.fail( npe );
}
catch( WikiException e )
{
@@ -437,7 +435,7 @@ public class PageRenamerTest
try
{
// renaming an existing page, and we call m_engine.saveText() before renaming
- // this does not Assert.fail under 2.5.116
+ // this does not Assertions.fail under 2.5.116
m_engine.saveText( "Main", "blablahblahbla" );
rename("Main", "Main8887");
rename("Main8887", "Main");
@@ -446,7 +444,7 @@ public class PageRenamerTest
{
npe.printStackTrace();
System.out.println("NPE: Bug 85 caught?");
- Assert.fail();
+ Assertions.fail( npe );
}
}
@@ -460,7 +458,7 @@ public class PageRenamerTest
rename ("TestPage2", "Test");
- Assert.assertEquals( "[[Link to TestPage2|TestPage2|target='_new']", m_engine.getText( "TestPage" ).trim() );
+ Assertions.assertEquals( "[[Link to TestPage2|TestPage2|target='_new']", m_engine.getText( "TestPage" ).trim() );
}
@Test
@@ -473,7 +471,7 @@ public class PageRenamerTest
rename ("TestPage2", "Test");
- Assert.assertEquals( "~[Link to TestPage2|TestPage2|target='_new']", m_engine.getText( "TestPage" ).trim() );
+ Assertions.assertEquals( "~[Link to TestPage2|TestPage2|target='_new']", m_engine.getText( "TestPage" ).trim() );
}
/**
@@ -490,14 +488,14 @@ public class PageRenamerTest
rename( "TestPageReferred", "TestPageReferredNew" );
String data = m_engine.getPureText( "TestPageReferring", WikiProvider.LATEST_VERSION );
- Assert.assertEquals( "page not renamed", "[Test Page Referred|TestPageReferredNew]", data.trim() );
+ Assertions.assertEquals( "[Test Page Referred|TestPageReferredNew]", data.trim(), "page not renamed" );
Collection< String > refs = m_engine.getReferenceManager().findReferrers( "TestPageReferred" );
- Assert.assertNull( "oldpage", refs );
+ Assertions.assertNull( refs, "oldpage" );
refs = m_engine.getReferenceManager().findReferrers( "TestPageReferredNew" );
- Assert.assertEquals( "new size", 1, refs.size() );
- Assert.assertEquals( "wrong ref", "TestPageReferring", (String) refs.iterator().next() );
+ Assertions.assertEquals( 1, refs.size(), "new size" );
+ Assertions.assertEquals( "TestPageReferring", refs.iterator().next(), "wrong ref" );
}
/** https://issues.apache.org/jira/browse/JSPWIKI-398 */
@@ -511,14 +509,14 @@ public class PageRenamerTest
rename( "Link one", "Link uno" );
String data = m_engine.getPureText( "RenameTest", WikiProvider.LATEST_VERSION );
- Assert.assertEquals( "page not renamed", "[link one|Link uno] [link two]", data.trim() );
+ Assertions.assertEquals( "[link one|Link uno] [link two]", data.trim(), "page not renamed" );
Collection< String > refs = m_engine.getReferenceManager().findReferrers( "Link one" );
- Assert.assertNull( "oldpage", refs );
+ Assertions.assertNull( refs, "oldpage" );
refs = m_engine.getReferenceManager().findReferrers( "Link uno" );
- Assert.assertEquals( "new size", 1, refs.size() );
- Assert.assertEquals( "wrong ref", "RenameTest", (String) refs.iterator().next() );
+ Assertions.assertEquals( 1, refs.size(), "new size" );
+ Assertions.assertEquals( "RenameTest", refs.iterator().next() , "wrong ref");
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/diff/ContextualDiffProviderTest.java b/jspwiki-war/src/test/java/org/apache/wiki/diff/ContextualDiffProviderTest.java
index 50ae0f6..f2181d1 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/diff/ContextualDiffProviderTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/diff/ContextualDiffProviderTest.java
@@ -26,8 +26,8 @@ import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiPage;
import org.apache.wiki.api.exceptions.WikiException;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class ContextualDiffProviderTest
{
@@ -168,12 +168,12 @@ public class ContextualDiffProviderTest
}
- // FIXME: This test Assert.fails; must be enabled again asap.
+ // FIXME: This test Assertions.fails; must be enabled again asap.
/*
@Test
public void testKnownProblemCases() throws NoRequiredPropertyException, IOException
{
- //These all Assert.fail...
+ //These all Assertions.fail...
//make two consequtive changes
diffTest(null, "A B C D", "A b c D", "A |^b c^-B C-| D");
@@ -184,7 +184,7 @@ public class ContextualDiffProviderTest
//acually returns -> "A |^BC^-B-| |-C -|D"
- //These Assert.failures are all due to how we process the diff results, we need to collapse
+ //These Assertions.failures are all due to how we process the diff results, we need to collapse
//adjacent edits into one...
}
@@ -209,7 +209,7 @@ public class ContextualDiffProviderTest
WikiContext ctx = new WikiContext( engine, new WikiPage(engine,"Dummy") );
String actualDiff = diff.makeDiffHtml( ctx, oldText, newText);
- Assert.assertEquals(expectedDiff, actualDiff);
+ Assertions.assertEquals(expectedDiff, actualDiff);
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/filters/DefaultFilterManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/filters/DefaultFilterManagerTest.java
index 9b8d7dd..ff3d72e 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/filters/DefaultFilterManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/filters/DefaultFilterManagerTest.java
@@ -26,16 +26,16 @@ import org.apache.log4j.PropertyConfigurator;
import org.apache.wiki.TestEngine;
import org.apache.wiki.api.engine.FilterManager;
import org.apache.wiki.api.filters.PageFilter;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class DefaultFilterManagerTest {
Properties props = TestEngine.getTestProperties();
TestEngine engine;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
PropertyConfigurator.configure(props);
engine = new TestEngine(props);
@@ -45,35 +45,35 @@ public class DefaultFilterManagerTest {
public void testInitFilters() throws Exception {
FilterManager m = new DefaultFilterManager( engine, props );
- List l = m.getFilterList();
+ List<PageFilter> l = m.getFilterList();
- Assert.assertEquals("Wrong number of filters", 2, l.size());
+ Assertions.assertEquals( 2, l.size(), "Wrong number of filters" );
- Iterator i = l.iterator();
- PageFilter f1 = (PageFilter)i.next();
+ Iterator<PageFilter> i = l.iterator();
+ PageFilter f1 = i.next();
- Assert.assertTrue("Not a Profanityfilter", f1 instanceof ProfanityFilter);
+ Assertions.assertTrue( f1 instanceof ProfanityFilter, "Not a Profanityfilter" );
- PageFilter f2 = (PageFilter)i.next();
+ PageFilter f2 = i.next();
- Assert.assertTrue("Not a Testfilter", f2 instanceof TestFilter);
+ Assertions.assertTrue( f2 instanceof TestFilter, "Not a Testfilter" );
}
@Test
public void testInitParams() throws Exception {
FilterManager m = new DefaultFilterManager( engine, props );
- List l = m.getFilterList();
+ List<PageFilter> l = m.getFilterList();
- Iterator i = l.iterator();
+ Iterator<PageFilter> i = l.iterator();
i.next();
TestFilter f2 = (TestFilter)i.next();
Properties p = f2.m_properties;
- Assert.assertEquals("no foobar", "Zippadippadai", p.getProperty("foobar"));
+ Assertions.assertEquals( "Zippadippadai", p.getProperty("foobar"), "no foobar" );
- Assert.assertEquals("no blatblaa", "5", p.getProperty( "blatblaa" ) );
+ Assertions.assertEquals( "5", p.getProperty( "blatblaa" ), "no blatblaa" );
}
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
index 3700dc9..a28c79a 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/htmltowiki/HtmlStringToWikiTranslatorTest.java
@@ -18,9 +18,9 @@
*/
package org.apache.wiki.htmltowiki;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* JUnit test cases for Converting Html to Wiki Markup.
@@ -29,63 +29,63 @@ import org.junit.Test;
public class HtmlStringToWikiTranslatorTest {
HtmlStringToWikiTranslator html2wiki;
- @Before
+ @BeforeEach
public void setUp() {
html2wiki = new HtmlStringToWikiTranslator();
}
@Test
public void testAnchor() throws Exception {
- Assert.assertEquals( "[startup.bat]", html2wiki.translate(
+ Assertions.assertEquals( "[startup.bat]", html2wiki.translate(
" <a class=\"attachment\" href=\"attach?page=startup.bat\">startup.bat</a><a href=\"PageInfo.jsp?page=startup.bat\"><img src=\"images/attachment_small.png\" alt=\"(att)\" border=\"0\"></a>" ) );
- Assert.assertEquals( "[http://www.startup.de]", html2wiki.translate(
+ Assertions.assertEquals( "[http://www.startup.de]", html2wiki.translate(
"<a class=\"external\" href=\"http://www.startup.de\">http://www.startup.de</a><img class=\"outlink\" src=\"images/out.png\" alt=\"\">" ) );
- Assert.assertEquals( " [AbsolutelyTestNotExisting]\n\n",
+ Assertions.assertEquals( " [AbsolutelyTestNotExisting]\n\n",
html2wiki.translate(
"<table class=\"imageplugin\" align=\"left\" border=\"0\">\r\n" + "<tbody><tr><td><br>\r\n" + "</td></tr>\r\n" + "</tbody></table>\r\n"
+ "\r\n" + " [AbsolutelyTestNotExisting]<p>\r\n" + "<table class=\"imageplugin\" align=\"left\" border=\"0\">\r\n" + "\r\n"
+ "<tbody>\r\n" + "</tbody></table>\r\n" + "\r\n" + "</p><p>\r\n" + "</p>" ) );
- Assert.assertEquals( "[ThisPageDoesNotExist]", html2wiki.translate( "<a href=\"Edit.jsp?page=ThisPageDoesNotExist\">ThisPageDoesNotExist</a>" ) );
+ Assertions.assertEquals( "[ThisPageDoesNotExist]", html2wiki.translate( "<a href=\"Edit.jsp?page=ThisPageDoesNotExist\">ThisPageDoesNotExist</a>" ) );
- Assert.assertEquals( "[/JSPWiki/wysiwyg/FCKeditor/editor/images/smiley/msn/sad_smile.gif]",
+ Assertions.assertEquals( "[/JSPWiki/wysiwyg/FCKeditor/editor/images/smiley/msn/sad_smile.gif]",
html2wiki.translate( "<img src=\"/JSPWiki/wysiwyg/FCKeditor/editor/images/smiley/msn/sad_smile.gif\" alt=\"\"/>" ) );
- Assert.assertEquals( "[AugumentedWikiLinks|AugumentedWikiLinks|title='my \"custom\" title' target='_blank']", html2wiki.translate(
+ Assertions.assertEquals( "[AugumentedWikiLinks|AugumentedWikiLinks|title='my \"custom\" title' target='_blank']", html2wiki.translate(
"<a class=\"wikipage\" href=\"Wiki.jsp?page=AugumentedWikiLinks\" target=\"_blank\" title=\"my 'custom' title\">AugumentedWikiLinks</a>" ) );
// footnote links
- Assert.assertEquals( "[23]", html2wiki.translate( "<a class=\"footnoteref\" href=\"#ref-PageName-23\">[23]</a>" ) );
- Assert.assertEquals( "[something|23]", html2wiki.translate( "<a class=\"footnoteref\" href=\"#ref-PageName-23\">[something]</a>" ) );
+ Assertions.assertEquals( "[23]", html2wiki.translate( "<a class=\"footnoteref\" href=\"#ref-PageName-23\">[23]</a>" ) );
+ Assertions.assertEquals( "[something|23]", html2wiki.translate( "<a class=\"footnoteref\" href=\"#ref-PageName-23\">[something]</a>" ) );
}
@Test
public void testTable() throws Exception {
- Assert.assertEquals( "a\n| erste\n", html2wiki.translate( "a <table border=\"1\"> <tbody><tr> <td> erste</td> </tr> </tbody> </table>" ) );
+ Assertions.assertEquals( "a\n| erste\n", html2wiki.translate( "a <table border=\"1\"> <tbody><tr> <td> erste</td> </tr> </tbody> </table>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"|| Throalisches Jahr || Ereignis\n" + "| 100 v. TH | Elianer Messias \u00fcbersetzt die tausendj\u00e4hrigen B\u00fccher von Harrow.\n"
+ "| 50 v. TH | Gr\u00fcndung Nehr?eshams und der ewigen Bibliothek.\n",
html2wiki.translate( "<table class=\"wikitable\" border=\"1\"><tbody><tr><th> Throalisches Jahr </th><th> Ereignis</th></tr>\n"
+ "<tr><td> 100 v. TH</td><td> Elianer Messias \u00fcbersetzt die tausendj\u00e4hrigen B\u00fccher von Harrow.</td></tr>\n"
+ "<tr><td> 50 v. TH</td><td> Gr\u00fcndung Nehr?eshams und der ewigen Bibliothek.</td></tr>\n" + "</tbody></table>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"|| Throalisches Jahr || Ereignis\n" + "| 100 v. TH | Elianer Messias \u00fcbersetzt die tausendj\u00e4hrigen B\u00fccher von Harrow.\n"
+ "| 50 v. TH | Gr\u00fcndung Nehr?eshams und der ewigen Bibliothek.\n\u00A0",
html2wiki.translate( "<table class=\"wikitable\" border=\"1\"><tbody><tr><th> Throalisches Jahr </th><th> Ereignis</th></tr>\n"
+ "<tr><td> 100 v. TH</td><td> Elianer Messias \u00fcbersetzt die tausendj\u00e4hrigen B\u00fccher von Harrow.</td></tr>\n"
+ "<tr><td> 50 v. TH</td><td> Gr\u00fcndung Nehr?eshams und der ewigen Bibliothek.</td></tr>\n" + "</tbody></table> " ) );
- Assert.assertEquals( "| 3. Rang | Name des Helden, den der Bogen t\u00f6ten sollte.\n" + "| F\u00e4higkeit | Bonus auf die Initiative von 1\n",
+ Assertions.assertEquals( "| 3. Rang | Name des Helden, den der Bogen t\u00f6ten sollte.\n" + "| F\u00e4higkeit | Bonus auf die Initiative von 1\n",
html2wiki.translate(
"<table class=\"wikitable\" border=\"1\"><tbody><tr><td> 3. Rang</td><td> Name des Helden, den der Bogen t\u00f6ten sollte.</td></tr>\n"
+ "<tr><td> F\u00e4higkeit</td><td> Bonus auf die Initiative von 1</td></tr></tbody></table></p><p>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"| Name: [Christian|ChristianS] \\\\ Geschicklichkeit: 2 \\\\ Hang zu perversen Sexorgien. Jongliert mit Worten und K\u00f6pfen. \\\\ [Berian Nachtschleicher|Berian] \\\\ [XLerul] \\\\ [Effifot Erif|EffifotErif]\n",
html2wiki.translate(
"<table class=\"wikitable\" border=\"1\"><tbody><tr><td> Name: <a class=\"wikipage\" href=\"Wiki.jsp?page=ChristianS\">Christian</a> <br> Geschicklichkeit: 2 <br> Hang zu perversen Sexorgien. Jongliert mit Worten und K\u00f6pfen. <br> <a class=\"wikipage\" href=\"Wiki.jsp?page=Berian\">Berian Nachtschleicher</a> <br> <a class=\"wikipage\" href=\"Wiki.jsp?page=XLerul\">XLerul</a> <br> <a class=\"wikipage\" href=\"Wiki.jsp?page=EffifotErif\">Effifot Erif</a></td></t [...]
@@ -94,51 +94,51 @@ public class HtmlStringToWikiTranslatorTest {
@Test
public void testRulers() throws Exception {
- Assert.assertEquals( "a\n----\nb", html2wiki.translate( "a<hr/>b" ) );
- Assert.assertEquals( "by\n" + "----\n" + "Dies", html2wiki.translate( "by\n" + "<hr>\n" + "Dies" ) );
+ Assertions.assertEquals( "a\n----\nb", html2wiki.translate( "a<hr/>b" ) );
+ Assertions.assertEquals( "by\n" + "----\n" + "Dies", html2wiki.translate( "by\n" + "<hr>\n" + "Dies" ) );
}
@Test
public void testParagraphs() throws Exception {
- Assert.assertEquals( "a\nb\nc", html2wiki.translate( "a<p>b</p>c" ) );
+ Assertions.assertEquals( "a\nb\nc", html2wiki.translate( "a<p>b</p>c" ) );
- Assert.assertEquals( "ab", html2wiki.translate( "a<p></p>b" ) );
+ Assertions.assertEquals( "ab", html2wiki.translate( "a<p></p>b" ) );
- Assert.assertEquals( "a\n\nb", html2wiki.translate( "a<p>\n</p>b" ) );
+ Assertions.assertEquals( "a\n\nb", html2wiki.translate( "a<p>\n</p>b" ) );
- Assert.assertEquals( "\n\\\\\n__Willkommen__ \\\\\n\\\\\nUnd niemand wird sie sehen \\\\\nEine Page ...\n\nAls Unterthema\n", html2wiki.translate(
+ Assertions.assertEquals( "\n\\\\\n__Willkommen__ \\\\\n\\\\\nUnd niemand wird sie sehen \\\\\nEine Page ...\n\nAls Unterthema\n", html2wiki.translate(
"<p><br />\n<strong>Willkommen</strong> <br />\n<br />\nUnd niemand wird sie sehen <br />\nEine Page ...</p>\n<p>Als Unterthema</p>" ) );
- Assert.assertEquals( "\n\u00A0\n\nTop\n\nBottom\n\n\n", html2wiki.translate( "<p> </p><p>Top</p>\n<p></p>\n<p></p>\n<p>Bottom</p> <p> </p>" ) );
+ Assertions.assertEquals( "\n\u00A0\n\nTop\n\nBottom\n\n\n", html2wiki.translate( "<p> </p><p>Top</p>\n<p></p>\n<p></p>\n<p>Bottom</p> <p> </p>" ) );
}
@Test
public void testWhitespace() throws Exception {
- Assert.assertEquals( "", html2wiki.translate( "" ) );
- Assert.assertEquals( "", html2wiki.translate( " " ) );
- Assert.assertEquals( "", html2wiki.translate( "<div>\n\n\n</div>" ) );
- Assert.assertEquals( "a ", html2wiki.translate( "a\n \n\n \t\r\n" ) );
+ Assertions.assertEquals( "", html2wiki.translate( "" ) );
+ Assertions.assertEquals( "", html2wiki.translate( " " ) );
+ Assertions.assertEquals( "", html2wiki.translate( "<div>\n\n\n</div>" ) );
+ Assertions.assertEquals( "a ", html2wiki.translate( "a\n \n\n \t\r\n" ) );
}
@Test
public void testLists() throws Exception {
- Assert.assertEquals( "\n* Punkt 1\n* Punkt 2\n", html2wiki.translate( "<ul><li>Punkt 1</li><li>Punkt 2</li></ul>" ) );
- Assert.assertEquals( "\n# Punkt 1\n# Punkt 2\n", html2wiki.translate( "<ol><li>Punkt 1</li><li>Punkt 2</li></ol>" ) );
- Assert.assertEquals( "\n# Punkt 1\n## Punkt 2\n\n", html2wiki.translate( "<ol><li>Punkt 1<ol><li>Punkt 2</li></ol></li></ol>" ) );
- Assert.assertEquals( "\n* Punkt 1\n** Punkt 2\n\n", html2wiki.translate( "<ul><li>Punkt 1<ul><li>Punkt 2</li></ul></li></ul>" ) );
- Assert.assertEquals( "\n* Punkt 1\n*# Punkt 2\n\n", html2wiki.translate( "<ul><li>Punkt 1<ol><li>Punkt 2</li></ol></li></ul>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals( "\n* Punkt 1\n* Punkt 2\n", html2wiki.translate( "<ul><li>Punkt 1</li><li>Punkt 2</li></ul>" ) );
+ Assertions.assertEquals( "\n# Punkt 1\n# Punkt 2\n", html2wiki.translate( "<ol><li>Punkt 1</li><li>Punkt 2</li></ol>" ) );
+ Assertions.assertEquals( "\n# Punkt 1\n## Punkt 2\n\n", html2wiki.translate( "<ol><li>Punkt 1<ol><li>Punkt 2</li></ol></li></ol>" ) );
+ Assertions.assertEquals( "\n* Punkt 1\n** Punkt 2\n\n", html2wiki.translate( "<ul><li>Punkt 1<ul><li>Punkt 2</li></ul></li></ul>" ) );
+ Assertions.assertEquals( "\n* Punkt 1\n*# Punkt 2\n\n", html2wiki.translate( "<ul><li>Punkt 1<ol><li>Punkt 2</li></ol></li></ul>" ) );
+ Assertions.assertEquals(
"\n# list item 1\n# list item 2\n## list item 2.1\n##* list item 2.1.1\n##* list item 2.1.2\n## list item 2.2\n# list item 3\n## list item 3.1\n##* list item 3.1.1\n## list item 3.2\n# list item 4\n",
html2wiki.translate(
"<ol> <li>list item 1</li> <li>list item 2 <ol> <li>list item 2.1 <ul> <li>list item 2.1.1</li> <li>list item 2.1.2</li> </ul> </li> <li>list item 2.2</li> </ol> </li> <li>list item 3 <ol> <li>list item 3.1 <ul> <li>list item 3.1.1</li> </ul> </li> <li>list item 3.2</li> </ol> </li> <li>list item 4</li> </ol>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"\n* Diese Karte kann von jedem editiert und um neue Links erweitert werden. \\\\Klickt einfach unten neben der Karte auf {{{[edit]}}}\n",
html2wiki.translate(
"<ul><li> Diese Karte kann von jedem editiert und um neue Links erweitert werden.<br>Klickt einfach unten neben der Karte auf <span style=\"font-family: monospace; white-space: pre;\">[edit]</span></li></ul>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"\n* Diese Karte kann von jedem editiert und um neue Links erweitert werden. \\\\Klickt einfach unten neben der Karte auf {{{[edit]}}}\n",
html2wiki.translate(
"<ul><li> Diese Karte kann von jedem editiert und um neue Links erweitert werden.<br>Klickt einfach unten neben der Karte auf <span style=\"font-family: monospace; white-space: pre;\">[edit]</span></li></ul>" ) );
@@ -147,67 +147,67 @@ public class HtmlStringToWikiTranslatorTest {
@Test
public void testPre() throws Exception {
- Assert.assertEquals( "\n{{{hallo}}}\n", html2wiki.translate( "<pre>hallo</pre>" ) );
- Assert.assertEquals( "\n{{{Hallo\nWelt!\n\n}}}\n", html2wiki.translate( "<pre>Hallo<br>Welt!<br><br></pre>" ) );
- Assert.assertEquals( "\n{{{\n\n\n\nHallo\n\n\n\nWelt!\n\n\n\n}}}\n",
+ Assertions.assertEquals( "\n{{{hallo}}}\n", html2wiki.translate( "<pre>hallo</pre>" ) );
+ Assertions.assertEquals( "\n{{{Hallo\nWelt!\n\n}}}\n", html2wiki.translate( "<pre>Hallo<br>Welt!<br><br></pre>" ) );
+ Assertions.assertEquals( "\n{{{\n\n\n\nHallo\n\n\n\nWelt!\n\n\n\n}}}\n",
html2wiki.translate( "\n\n\n\n<pre>\n\n\n\nHallo\n\n\n\nWelt!\n\n\n\n</pre>\n\n\n\n" ) );
- Assert.assertEquals( "\n{{{\n\n* Baltramon \n lasdjfh\n\n}}}\n", html2wiki.translate( "<pre>\n\n* Baltramon \n lasdjfh\n\n</pre>" ) );
+ Assertions.assertEquals( "\n{{{\n\n* Baltramon \n lasdjfh\n\n}}}\n", html2wiki.translate( "<pre>\n\n* Baltramon \n lasdjfh\n\n</pre>" ) );
/*
- * // The style "font-family: courier new" is no longer translated as monospace text, so this test case is no longer needed. Assert.assertEquals(
+ * // The style "font-family: courier new" is no longer translated as monospace text, so this test case is no longer needed. Assertions.assertEquals(
* "Diese Karte{{{ kann }}} von", html2wiki .translate( "Diese Karte<span style=\"font-family: courier new,courier,mono;\"> kann </span> von" ) );
*/
- Assert.assertEquals( "Fahrt einfac{{{h mit\u00A0\u00A0 \n der \u00A0 Maus}}} drueber", html2wiki
+ Assertions.assertEquals( "Fahrt einfac{{{h mit\u00A0\u00A0 \n der \u00A0 Maus}}} drueber", html2wiki
.translate( "Fahrt einfac<span style=\"font-family: monospace; white-space: pre;\">h mit <br> der Maus</span> drueber" ) );
}
@Test
public void testTT() throws Exception {
- Assert.assertEquals( "{{hallo}}", html2wiki.translate( "<tt>hallo</tt>" ) );
- Assert.assertEquals( "{{hallo}}", html2wiki.translate( "<code>hallo</code>" ) );
+ Assertions.assertEquals( "{{hallo}}", html2wiki.translate( "<tt>hallo</tt>" ) );
+ Assertions.assertEquals( "{{hallo}}", html2wiki.translate( "<code>hallo</code>" ) );
}
@Test
public void testCenter() throws Exception {
- Assert.assertEquals( "\n%%( text-align: center; )\nHello \\\\\nWorld!\n/%\n",
+ Assertions.assertEquals( "\n%%( text-align: center; )\nHello \\\\\nWorld!\n/%\n",
html2wiki.translate( "<div style=\"text-align: center;\">Hello<br>World!</div>" ) );
- Assert.assertEquals( "__%%( text-align: center; display: block; )Hello \\\\World!/%__",
+ Assertions.assertEquals( "__%%( text-align: center; display: block; )Hello \\\\World!/%__",
html2wiki.translate( "<span style=\"font-weight: bold; text-align: center; display: block;\">Hello<br>World!</span>" ) );
}
@Test
public void testImage() throws Exception {
- Assert.assertEquals( "[{Image src='Homunkulus/homunculus4.jpg' align='left'}]", html2wiki.translate(
+ Assertions.assertEquals( "[{Image src='Homunkulus/homunculus4.jpg' align='left'}]", html2wiki.translate(
"<table class=\"imageplugin\" align=\"left\" border=\"0\"> <tbody><tr><td><img src=\"attach?page=Homunkulus%2Fhomunculus4.jpg\"></td></tr> </tbody></table>" ) );
- Assert.assertEquals( "[{Image src=\'AbenteuerQuilpins/Quilpins.jpg\' align=\'left\'}]",
+ Assertions.assertEquals( "[{Image src=\'AbenteuerQuilpins/Quilpins.jpg\' align=\'left\'}]",
html2wiki.translate( "<table class=\"imageplugin\" align=\"left\" border=\"0\">\r\n"
+ "<tbody><tr><td><img src=\"attach?page=AbenteuerQuilpins%2FQuilpins.jpg\"></td></tr>\r\n</tbody>" + "</table>" ) );
- Assert.assertEquals( "[{Image src=\'AbenteuerQuilpins/Quilpins.jpg\' caption=\'Testing Image\' style=\'font-size: 120%; color: green;\'}]",
+ Assertions.assertEquals( "[{Image src=\'AbenteuerQuilpins/Quilpins.jpg\' caption=\'Testing Image\' style=\'font-size: 120%; color: green;\'}]",
html2wiki.translate( "<table class=\"imageplugin\" style=\"font-size: 120%; color: green;\" border=\"0\">\r\n"
+ "<caption align=\"bottom\">Testing Image</caption>\r\n"
+ "<tbody><tr><td><img src=\"attach?page=AbenteuerQuilpins%2FQuilpins.jpg\"></td></tr>\r\n</tbody>" + "</table>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"[{Image src=\'http://opi.yahoo.com/online?u=YahooUser1234&m=g&t=2\' link=\'http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&.src=pg\'}]",
html2wiki.translate( "<table class=\"imageplugin\" border=\"0\">\r\n" + "<tbody><tr><td>"
+ "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&.src=pg\">"
+ "<img src=\"http://opi.yahoo.com/online?u=YahooUser1234&m=g&t=2\">" + "</a></td></tr>\r\n" + "</tbody>" + "</table>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"[{Image src=\'homunculus4.jpg\' align=\'left\' height=\'100px\' width=\'100px\' alt=\'alt text\' caption=\'caption text\' link=\'http://google.de\' border=\'1\'}]",
html2wiki.translate( "<table class=\"imageplugin\" align=\"left\" border=\"0\"> \r\n"
+ " <caption align=\"bottom\">caption text</caption> \r\n" + " <tbody><tr><td>\r\n"
+ " <a href=\"http://google.de\"><img src=\"homunculus4.jpg\" alt=\"alt text\" border=\"1\" height=\"100px\" width=\"100px\">\r\n"
+ " </a></td></tr> \r\n" + " </tbody> \r\n" + "</table>" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"[{Image src=\'http://opi.yahoo.com/online?u=YahooUser1234&m=g&t=2\' link=\'http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&.src=pg\'}]",
html2wiki.translate( " <a href=\"http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&.src=pg\">\r\n"
+ " <img src=\"http://opi.yahoo.com/online?u=YahooUser1234&m=g&t=2\">\r\n" + " </a" ) );
@@ -216,7 +216,7 @@ public class HtmlStringToWikiTranslatorTest {
@Test
public void testPlugin() throws Exception {
- Assert.assertEquals(
+ Assertions.assertEquals(
"This is a private homepage done by\n" + "----\n" + "Dies ist eine private, nicht-kommerzielle Homepage von\n"
+ "[{Text2gif width=\'150\' height=\'100\' \n" + " \n" + "Sebastian L. Baltes \n" + "Lange Str. 53 \n" + "44137 Dortmund \n" + " \n"
+ "email: info@sorokan.de \n" + "}]\n",
@@ -228,90 +228,90 @@ public class HtmlStringToWikiTranslatorTest {
@Test
public void testCSS() throws Exception {
- Assert.assertEquals( "%%( color: rgb(255, 0, 0); )Und niemand wird sie sehen/%, die",
+ Assertions.assertEquals( "%%( color: rgb(255, 0, 0); )Und niemand wird sie sehen/%, die",
html2wiki.translate( "<span style=\"color: rgb(255, 0, 0);\">Und niemand wird sie sehen</span>, die" ) );
- Assert.assertEquals(
+ Assertions.assertEquals(
"\n%%information\nCSS class here\n/%\n\nFont %%( color: #ff9900; font-family: arial; font-size: large; )styling here./% Some %%( background-color: #ffff00; )more here/%.\n",
html2wiki.translate(
"<div class=\"information\">CSS class here</div>\n" + "<p>Font <font face=\"Arial\" color=\"#ff9900\" size=\"5\">styling here.</font>"
+ " Some <font style=\"background-color: #ffff00\">more here</font>.</p>" ) );
- Assert.assertEquals( "\n\n%%( text-align: center; )\nsome leading text %%strike line through this text/% some trailing text\n/%\n\n",
+ Assertions.assertEquals( "\n\n%%( text-align: center; )\nsome leading text %%strike line through this text/% some trailing text\n/%\n\n",
html2wiki.translate( "<p align=\"center\">some leading text <strike>line through this text</strike> some trailing text</p>" ) );
}
@Test
public void testParsing() throws Exception {
- Assert.assertEquals( "Hello World!", html2wiki.translate( "Hello World!" ) );
+ Assertions.assertEquals( "Hello World!", html2wiki.translate( "Hello World!" ) );
- Assert.assertEquals( "a", html2wiki.translate( "a" ) );
+ Assertions.assertEquals( "a", html2wiki.translate( "a" ) );
- Assert.assertEquals( "a \\\\b", html2wiki.translate( "a<br/>b" ) );
+ Assertions.assertEquals( "a \\\\b", html2wiki.translate( "a<br/>b" ) );
- Assert.assertEquals( "\\\\\\", html2wiki.translate( "\\\\\\" ) );
+ Assertions.assertEquals( "\\\\\\", html2wiki.translate( "\\\\\\" ) );
- Assert.assertEquals( "[{Test\nHello World!}]", html2wiki.translate( "[{Test\\\\Hello World!}]" ) );
+ Assertions.assertEquals( "[{Test\nHello World!}]", html2wiki.translate( "[{Test\\\\Hello World!}]" ) );
- Assert.assertEquals( "{{{[{Test\\\\Hello World!}]}}}", html2wiki.translate( "{{{[{Test\\\\Hello World!}]}}}" ) );
+ Assertions.assertEquals( "{{{[{Test\\\\Hello World!}]}}}", html2wiki.translate( "{{{[{Test\\\\Hello World!}]}}}" ) );
- Assert.assertEquals( "{{{[{Test\\\\Hello World!}]}}}{{{[{Test\\\\\\\\Hello World!}]}}}[{Test\n\nHello World!}][{Test\n\nHello World!}]", html2wiki
+ Assertions.assertEquals( "{{{[{Test\\\\Hello World!}]}}}{{{[{Test\\\\\\\\Hello World!}]}}}[{Test\n\nHello World!}][{Test\n\nHello World!}]", html2wiki
.translate( "{{{[{Test\\\\Hello World!}]}}}{{{[{Test\\\\\\\\Hello World!}]}}}[{Test\\\\\\\\Hello World!}][{Test\\\\\\\\Hello World!}]" ) );
}
@Test
public void testBoldAndItalic() throws Exception {
- Assert.assertEquals( "Dies ist __bold__, ''italic'' und __''both''__.", html2wiki.translate(
+ Assertions.assertEquals( "Dies ist __bold__, ''italic'' und __''both''__.", html2wiki.translate(
"Dies ist <span style=\"font-weight: bold;\">bold</span>, <span style=\"font-style: italic;\">italic</span> und <span style=\"font-style: italic; font-weight: bold;\">both</span>." ) );
- Assert.assertEquals( "Dies ist __bold__, ''italic'' und __''both''__ 2.",
+ Assertions.assertEquals( "Dies ist __bold__, ''italic'' und __''both''__ 2.",
html2wiki.translate( "Dies ist <b>bold</b>, <i>italic</i> und <b><i>both</i></b> 2." ) );
- Assert.assertEquals( "Dies ist __bold__, ''italic'' und __''both''__ 3.",
+ Assertions.assertEquals( "Dies ist __bold__, ''italic'' und __''both''__ 3.",
html2wiki.translate( "Dies ist <strong>bold</strong>, <em>italic</em> und <strong><em>both</em></strong> 3." ) );
- Assert.assertEquals( "Wilma: ''Ich m\u00f6chte hiermal in allerDeutlichkeit sagen! ''",
+ Assertions.assertEquals( "Wilma: ''Ich m\u00f6chte hiermal in allerDeutlichkeit sagen! ''",
html2wiki.translate( "Wilma: <i>Ich m\u00f6chte hier\nmal in aller\nDeutlichkeit sagen! </i>" ) );
}
@Test
public void testHeading() throws Exception {
- Assert.assertEquals( "\n!!! Heading 1 should be translated to large heading.\n",
+ Assertions.assertEquals( "\n!!! Heading 1 should be translated to large heading.\n",
html2wiki.translate( "<h1>Heading 1 should be translated to large heading.</h1>" ) );
- Assert.assertEquals( "\n!!! Heading 2 should be translated to large heading.\n",
+ Assertions.assertEquals( "\n!!! Heading 2 should be translated to large heading.\n",
html2wiki.translate( "<h2>Heading 2 should be translated to large heading.</h2>" ) );
- Assert.assertEquals( "\n!! Heading 3 should be translated to medium heading.\n",
+ Assertions.assertEquals( "\n!! Heading 3 should be translated to medium heading.\n",
html2wiki.translate( "<h3>Heading 3 should be translated to medium heading.</h3>" ) );
- Assert.assertEquals( "\n! Heading 4 should be translated to small heading.\n",
+ Assertions.assertEquals( "\n! Heading 4 should be translated to small heading.\n",
html2wiki.translate( "<h4>Heading 4 should be translated to small heading.</h4>" ) );
}
@Test
public void testForm() throws Exception {
- Assert.assertEquals( "\n[{FormOpen form='myForm'}]\n\n[{FormClose}]\n",
+ Assertions.assertEquals( "\n[{FormOpen form='myForm'}]\n\n[{FormClose}]\n",
html2wiki.translate( "<div class=\"wikiform\">\n<form name=\"myForm\"><input name=\"formname\" value=\"myForm\" type=\"hidden\">\n</div>" ) );
- Assert.assertEquals( "[{FormInput type='hidden' name='myHiddenField' value='myHiddenField'}]myHiddenField",
+ Assertions.assertEquals( "[{FormInput type='hidden' name='myHiddenField' value='myHiddenField'}]myHiddenField",
html2wiki.translate( "<input name=\"nbf_myHiddenField\" value=\"myHiddenField\" type=\"hidden\">myHiddenField" ) );
- Assert.assertEquals( "[{FormInput type='checkbox' name='myCheckbox' value='myCheckbox' checked='checked'}]myCheckbox",
+ Assertions.assertEquals( "[{FormInput type='checkbox' name='myCheckbox' value='myCheckbox' checked='checked'}]myCheckbox",
html2wiki.translate( "<input checked=\"checked\" value=\"myCheckbox\" name=\"nbf_myCheckbox\" type=\"checkbox\">myCheckbox" ) );
- Assert.assertEquals( "[{FormInput type='radio' name='myRadioButton' value='myRadioButton'}]myRadioButton",
+ Assertions.assertEquals( "[{FormInput type='radio' name='myRadioButton' value='myRadioButton'}]myRadioButton",
html2wiki.translate( "<input name=\"nbf_myRadioButton\" value=\"myRadioButton\" type=\"radio\">myRadioButton" ) );
- Assert.assertEquals( "[{FormInput type='button' name='myButton' value='myButton'}]myButton",
+ Assertions.assertEquals( "[{FormInput type='button' name='myButton' value='myButton'}]myButton",
html2wiki.translate( "<input name=\"nbf_myButton\" value=\"myButton\" type=\"button\">myButton" ) );
- Assert.assertEquals( "[{FormTextarea name='myTextarea' rows='6' cols='50'}]myTextarea",
+ Assertions.assertEquals( "[{FormTextarea name='myTextarea' rows='6' cols='50'}]myTextarea",
html2wiki.translate( "<textarea cols=\"50\" name=\"nbf_myTextarea\" rows=\"6\"></textarea>myTextarea" ) );
- Assert.assertEquals( "[{FormSelect name='mySelectionList' value='apple;*orange;pear'}]mySelectList",
+ Assertions.assertEquals( "[{FormSelect name='mySelectionList' value='apple;*orange;pear'}]mySelectList",
html2wiki.translate( "<select name=\"nbf_mySelectionList\">\n" + "<option value=\"apple\">apple</option>\n"
+ "<option selected=\"selected\" value=\"orange\">orange</option>\n" + "<option value=\"pear\">pear</option>\n"
+ "</select>mySelectList" ) );
@@ -320,14 +320,14 @@ public class HtmlStringToWikiTranslatorTest {
@Test
public void testDefinitionList() throws Exception {
- Assert.assertEquals( "\n;__Priority__:High\n\n;__TODO Name__:Initialization\n\n;__Requester__:John Smith\n",
+ Assertions.assertEquals( "\n;__Priority__:High\n\n;__TODO Name__:Initialization\n\n;__Requester__:John Smith\n",
html2wiki.translate( "<dl><dt><b>Priority</b></dt><dd>High</dd></dl>\n" + "<dl><dt><b>TODO Name</b></dt><dd>Initialization</dd></dl>\n"
+ "<dl><dt><b>Requester</b></dt><dd>John Smith</dd></dl>\n" ) );
- Assert.assertEquals( "Some text here\n;:(A)indented comment here\n\n;:(B)another comment here\n", html2wiki.translate(
+ Assertions.assertEquals( "Some text here\n;:(A)indented comment here\n\n;:(B)another comment here\n", html2wiki.translate(
"Some text here\n<dl><dt></dt><dd>(A)indented comment here</dd></dl>\n" + "<dl><dt></dt><dd>(B)another comment here</dd></dl>\n" ) );
- Assert.assertEquals( "\n;__New Page Name__:[{FormInput type='text' name='newPageName'}]\n",
+ Assertions.assertEquals( "\n;__New Page Name__:[{FormInput type='text' name='newPageName'}]\n",
html2wiki.translate( "\n<dl><dt><b>New Page Name</b></dt><dd><input name=\"nbf_newPageName\" type=\"text\"></dd></dl>\n" ) );
}
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/i18n/InternationalizationManagerTest.java b/jspwiki-war/src/test/java/org/apache/wiki/i18n/InternationalizationManagerTest.java
index 51d3967..a7e421c 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/i18n/InternationalizationManagerTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/i18n/InternationalizationManagerTest.java
@@ -17,19 +17,19 @@
under the License.
*/
package org.apache.wiki.i18n;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Locale;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
public class InternationalizationManagerTest
{
InternationalizationManager i18n = new InternationalizationManager( null );
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
// enforce english locale as the default one. Otherwise, if your default locale is one
@@ -45,7 +45,7 @@ public class InternationalizationManagerTest
Locale.ENGLISH,
"security.error.cannot.rename",
"Test User" );
- Assert.assertEquals( "Cannot rename: the login name 'Test User' is already taken.", str );
+ Assertions.assertEquals( "Cannot rename: the login name 'Test User' is already taken.", str );
}
@Test
@@ -55,7 +55,7 @@ public class InternationalizationManagerTest
Locale.ENGLISH,
"notification.createUserProfile.accept.content",
"JSPWiki", "testUser", "Test User", "test@user.com", "www.foo.com" );
- Assert.assertEquals( "Congratulations! Your new profile on JSPWiki has been created. " +
+ Assertions.assertEquals( "Congratulations! Your new profile on JSPWiki has been created. " +
"Your profile details are as follows: \n\n" +
"Login name: testUser \n" +
"Your name : Test User \n" +
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/parser/CreoleToJSPWikiTranslatorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/parser/CreoleToJSPWikiTranslatorTest.java
index 8609066..ad9313e 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/parser/CreoleToJSPWikiTranslatorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/parser/CreoleToJSPWikiTranslatorTest.java
@@ -22,8 +22,8 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Properties;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class CreoleToJSPWikiTranslatorTest
@@ -36,7 +36,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is **bold**.";
- Assert.assertEquals("This is __bold__.", translate(src));
+ Assertions.assertEquals("This is __bold__.", translate(src));
}
@Test
@@ -44,7 +44,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "**This is all bold.**";
- Assert.assertEquals("__This is all bold.__", translate(src));
+ Assertions.assertEquals("__This is all bold.__", translate(src));
}
@Test
@@ -52,7 +52,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is **bold\nand still bold**.";
- Assert.assertEquals("This is __bold\nand still bold__.", translate(src));
+ Assertions.assertEquals("This is __bold\nand still bold__.", translate(src));
}
@Test
@@ -60,7 +60,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is **bold\r\n\r\nand no more bold.";
- Assert.assertEquals("This is __bold__\r\n\r\nand no more bold.", translate(src));
+ Assertions.assertEquals("This is __bold__\r\n\r\nand no more bold.", translate(src));
}
@Test
@@ -68,7 +68,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is //italic\r\nand still italic//.";
- Assert.assertEquals("This is ''italic\r\nand still italic''.", translate(src));
+ Assertions.assertEquals("This is ''italic\r\nand still italic''.", translate(src));
}
@Test
@@ -76,7 +76,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is //italic\r\n\r\nnand no more italic.";
- Assert.assertEquals("This is ''italic''\r\n\r\nnand no more italic.", translate(src));
+ Assertions.assertEquals("This is ''italic''\r\n\r\nnand no more italic.", translate(src));
}
@Test
@@ -84,7 +84,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is //italic//.";
- Assert.assertEquals("This is ''italic''.", translate(src));
+ Assertions.assertEquals("This is ''italic''.", translate(src));
}
@Test
@@ -92,21 +92,21 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is {{Image}}.";
- Assert.assertEquals("This is [{Image src='Image'}].", translate(src));
+ Assertions.assertEquals("This is [{Image src='Image'}].", translate(src));
}
@Test
public void testImageLink() throws Exception
{
String src = "This is [[http://www.wikicreole.org|{{Image}}]] with a link.";
- Assert.assertEquals("This is [{Image src='Image' link='http://www.wikicreole.org'}] with a link.", translate(src));
+ Assertions.assertEquals("This is [{Image src='Image' link='http://www.wikicreole.org'}] with a link.", translate(src));
}
@Test
public void testImageDescription() throws Exception
{
String src = "This is {{Image|Description}}.";
- Assert.assertEquals("This is [{Image src='Image' caption='Description'}].", translate(src));
+ Assertions.assertEquals("This is [{Image src='Image' caption='Description'}].", translate(src));
}
@Test
@@ -114,7 +114,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This is [[http://www.wikicreole.org|{{Image|Description}}]].";
- Assert.assertEquals("This is [{Image src='Image' link='http://www.wikicreole.org' caption='Description'}].", translate(src));
+ Assertions.assertEquals("This is [{Image src='Image' link='http://www.wikicreole.org' caption='Description'}].", translate(src));
}
@Test
@@ -122,7 +122,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This should be a [[hyperlink]]";
- Assert.assertEquals("This should be a [hyperlink]", translate(src));
+ Assertions.assertEquals("This should be a [hyperlink]", translate(src));
}
@Test
@@ -130,7 +130,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This should be a [[hyperlink too]]";
- Assert.assertEquals("This should be a [hyperlink too]", translate(src));
+ Assertions.assertEquals("This should be a [hyperlink too]", translate(src));
}
@Test
@@ -138,7 +138,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This should be a [[HyperLink]]";
- Assert.assertEquals("This should be a [HyperLink]", translate(src));
+ Assertions.assertEquals("This should be a [HyperLink]", translate(src));
}
@Test
@@ -146,7 +146,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This should be a [[HyperLink|here]]";
- Assert.assertEquals("This should be a [here|HyperLink]", translate(src));
+ Assertions.assertEquals("This should be a [here|HyperLink]", translate(src));
}
@Test
@@ -155,7 +155,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "This should be a [[HyperLink#heading|here]]";
- Assert.assertEquals("This should be a [here|HyperLink#heading]", translate(src));
+ Assertions.assertEquals("This should be a [here|HyperLink#heading]", translate(src));
}
@Test
@@ -163,7 +163,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "This should be a [[HyperLink#heading]]";
- Assert.assertEquals("This should be a [HyperLink#heading]", translate(src));
+ Assertions.assertEquals("This should be a [HyperLink#heading]", translate(src));
}
//
@@ -176,7 +176,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "[[DiscussionAboutWiki]] [[WikiMarkupDevelopment]].";
- Assert.assertEquals("[DiscussionAboutWiki] [WikiMarkupDevelopment].", translate(src));
+ Assertions.assertEquals("[DiscussionAboutWiki] [WikiMarkupDevelopment].", translate(src));
}
/** ******* Stuff not in JSPWikiMarkupParserTest ************************* */
@@ -187,7 +187,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "=====Level 4 heading";
- Assert.assertEquals("__Level 4 heading__", translate(src));
+ Assertions.assertEquals("__Level 4 heading__", translate(src));
}
@Test
@@ -196,7 +196,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "Sponsored by the [Wiki Symposium|http://www.wikisym.org/] and [i3G Institute|http://www.i3g.hs-heilbronn.de].";
- Assert.assertEquals(
+ Assertions.assertEquals(
"Sponsored by the [Wiki Symposium|http://www.wikisym.org/] and [i3G Institute|http://www.i3g.hs-heilbronn.de].",
translate(src));
}
@@ -205,7 +205,7 @@ public class CreoleToJSPWikiTranslatorTest
public void testHyperLinksJSPWiki() throws Exception
{
String src = "* [http://www.wikisym.org/cgi-bin/mailman/listinfo/wiki-research|Wiki research mailing list]";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -214,7 +214,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "Sponsored by the [[http://www.wikisym.org/|Wiki Symposium]] and [[http://www.i3g.hs-heilbronn.de|i3G Institute]].";
- Assert.assertEquals(
+ Assertions.assertEquals(
"Sponsored by the [Wiki Symposium|http://www.wikisym.org/] and [i3G Institute|http://www.i3g.hs-heilbronn.de].",
translate(src));
}
@@ -224,14 +224,14 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "{{{$$...$$}}}";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
public void testPreformattedCreole2() throws Exception
{
String src = "{{{\r\n" + "\r\n" + "[[http://en.wikipedia.org|wikipedia]]\r\n" + "}}}";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -240,7 +240,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "{{{\r\n" + "Guitar Chord C:\r\n" + "\r\n" + "||---|---|---|\r\n" + "||-0-|---|---|\r\n"
+ "||---|-0-|---|\r\n" + "||---|---|-0-|\r\n" + "||---|---|---|\\n" + "}}}";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -249,7 +249,7 @@ public class CreoleToJSPWikiTranslatorTest
// don't interpret plugins
String src = "{{{<<Test>>}}}";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -257,7 +257,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "{{{<<<Test>>>}}}";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -269,7 +269,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "[[http://www.wikicreole.org|external Links]]\r\n" + preformatted;
String target = "[external Links|http://www.wikicreole.org]\r\n" + preformatted;
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -280,7 +280,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "[http://www.wikicreole.org]\r\n" + preformatted;
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -289,14 +289,14 @@ public class CreoleToJSPWikiTranslatorTest
String src = "- 1\r\n" + "-- 2\r\n" + "--- 3\r\n" + "---- 4\r\n" + "----- 5";
String target = "* 1\r\n" + "** 2\r\n" + "*** 3\r\n" + "**** 4\r\n" + "***** 5";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
public void testLineAmbiguity() throws Exception
{
String src = "Some text\r\n\r\n----\r\n\r\nMore text";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -304,7 +304,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "Some **text**\r\n\r\n--Steff";
String target = "Some __text__\r\n\r\n--Steff";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
public void disabledTestLinebreakCreole() throws Exception
@@ -314,7 +314,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "My contact dates:\\\\\n" + "Pone: xyz\\\\\r\n" + "Fax: +45\\\\\n" + "Mobile: abc";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
public void disabledTestLinebreakCreoleShort() throws Exception
@@ -324,7 +324,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "a\\\\\n" + "b\\\\\n" + "c\n";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
public void disabledTestLinebreakCreoleWithLists() throws Exception
@@ -332,7 +332,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "*This\n" + "*Is\n" + "*a\n" + "*list";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -342,7 +342,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "Some test\r\n" + "\r\n" + "%%commentbox\r\n" + "Aloha World!\r\n" + "%%\r\n" + "\r\n"
+ "Does the pagefilter mess up special jspwiki css markup?";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -353,7 +353,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "* 1\r\n" + "** 1.1\r\n" + "** 1.2\r\n" + "* 2\r\n" + "---------\r\n" + "test\r\n" + "Test";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
/**
@@ -366,7 +366,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "* 1\r\n" + "** 1.1\r\n" + "** 1.2\r\n" + "* 2\r\n" + "---------\r\n" + "test";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -377,7 +377,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = " 1\\\\\r\n" + "~- 3\\\\\r\n" + "~===\\\\\r\n" + "~- 2\\\\";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -388,7 +388,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "{{{\r\n" + "{{{\r\n" + "{{Image}}\r\n" + "~}}}\r\n" + "}}}\r\n" + "Test";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -397,7 +397,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "|a|b\r\n" + "|c|d";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -408,7 +408,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "|a|b\r\n" + "|c|d";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -419,7 +419,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "before\r\n" + "|a|b\r\n" + "|c|d\r\n" + "after";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -430,7 +430,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "before\r\n" + "|a\\\\b|b\r\n" + "|c|d\r\n" + "after";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -442,7 +442,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "|a|b\r\n" + "\r\n" + "|x|y\r\nTest";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -452,7 +452,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "|=a|=b|\r\n" + "|c|d|";
String target = "||a||b\r\n" + "|c|d";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -463,7 +463,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "||a||b\r\n" + "|c|d";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -472,7 +472,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "||a||b\r\n" + "|c|d";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -483,7 +483,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "[{ImagePlugin src='abc'}]";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -492,7 +492,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "[{ImagePlugin src='abc'}]";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -501,7 +501,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "<This is HTML>";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -511,7 +511,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "[{FormOpen submit=\'http://jspwiki.apache.org\' }]";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -537,14 +537,14 @@ public class CreoleToJSPWikiTranslatorTest
//System.out.println(src);
//System.out.println(translate(src));
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
public void testHeaderNotAtBeginning()
{
String src = "Hallo==Hallo";
- Assert.assertEquals(src, translate(src));
+ Assertions.assertEquals(src, translate(src));
}
@Test
@@ -554,7 +554,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "||a||b\r\n" + "|[c]|d";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -564,7 +564,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "||a||b\r\n" + "|[c]|[{Image src='Image.png'}]";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -574,7 +574,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "Hallo das ist super\r\n!!Und jetzt\r\nGehts weiter";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -583,7 +583,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "# Hallo\r\n" + "-- Hallo\r\n" + "--- Hallo\r\n" + "Hi";
String target = "# Hallo\r\n" + "** Hallo\r\n" + "*** Hallo\r\n" + "Hi";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -592,7 +592,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "- Hallo\r\n" + "## Hallo\r\n" + "### Hallo\r\n" + "Hi";
String target = "* Hallo\r\n" + "## Hallo\r\n" + "### Hallo\r\n" + "Hi";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -608,7 +608,7 @@ public class CreoleToJSPWikiTranslatorTest
+ "#Language information\r\n" + "#Acronyms and abbreviations\r\n" + "#Emphasis and strong emphasis\r\n"
+ "#Quotes, inline and block\r\n" + "#Images";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -618,7 +618,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "Hallo\r\n-- [[Hanno]]";
Properties props = new Properties();
props.put("creole.dateFormat", "dd/MM/yyyy");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
}
@Test
@@ -629,7 +629,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "Hallo\r\n-- [[Hanno]], " + (new SimpleDateFormat("dd/MM/yyyy")).format(cal.getTime());
Properties props = new Properties();
props.put("creole.dateFormat", "dd/MM/yyyy");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
}
@Test
@@ -642,7 +642,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "Hallo\r\n-- [[Hanno]], " + (new SimpleDateFormat(format)).format(cal.getTime());
Properties props = new Properties();
props.put("creole.dateFormat", format);
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
}
@Test
@@ -650,7 +650,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "Hallo\r\n=Hallo\r\nHallo";
String target = "Hallo\r\n!!!Hallo\r\nHallo";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -660,7 +660,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "{{{Hallo\r\n" + "--~~~~\r\n" + "Hallo\r\n" + "}}}";
Properties props = new Properties();
props.put("creole.dateFormat", format);
- Assert.assertEquals(src, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
+ Assertions.assertEquals(src, new CreoleToJSPWikiTranslator().translateSignature(props, src, "Hanno"));
}
@Test
@@ -674,7 +674,7 @@ public class CreoleToJSPWikiTranslatorTest
+ "\r\n* nothing I hope\r\n" + "* maybe something\r\n" + "* we will soon see!\r\n"
+ "\r\n!!! and this is a big title ===============\r\n" + "\r\nWhat can we put here?\r\n"
+ "\r\n[{Image src='Web2.png'}]";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -682,15 +682,15 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "Hallo\r\nHallo[[ www.gmx.de]]Hallo\r\nHallo";
String target = "Hallo\r\nHallo[http://www.gmx.de]Hallo\r\nHallo";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
String src2 = "Hallo\r\nHallo[[www.gmx.de]]Hallo\r\nHallo";
String target2 = "Hallo\r\nHallo[http://www.gmx.de]Hallo\r\nHallo";
- Assert.assertEquals(target2, translate(src2));
+ Assertions.assertEquals(target2, translate(src2));
String src3 = "Hallo\r\nHallo[[www.gmx.de|GMX]]Hallo\r\nHallo";
String target3 = "Hallo\r\nHallo[GMX|http://www.gmx.de]Hallo\r\nHallo";
- Assert.assertEquals(target3, translate(src3));
+ Assertions.assertEquals(target3, translate(src3));
}
@Test
@@ -703,7 +703,7 @@ public class CreoleToJSPWikiTranslatorTest
props.put("creole.imagePlugin.para.NB", "border=0");
props.put("creole.imagePlugin.name", "ImageX");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -714,7 +714,7 @@ public class CreoleToJSPWikiTranslatorTest
Properties props = new Properties();
props.put("creole.imagePlugin.name", "ImageX");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -725,7 +725,7 @@ public class CreoleToJSPWikiTranslatorTest
Properties props = new Properties();
props.put("creole.imagePlugin.name", "ImageX");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -738,7 +738,7 @@ public class CreoleToJSPWikiTranslatorTest
props.put("creole.imagePlugin.para.NB", "border=0");
props.put("creole.imagePlugin.name", "ImageX");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -751,7 +751,7 @@ public class CreoleToJSPWikiTranslatorTest
props.put("creole.imagePlugin.para.NB", "border=0");
props.put("creole.imagePlugin.name", "ImageX");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -764,7 +764,7 @@ public class CreoleToJSPWikiTranslatorTest
props.put("creole.imagePlugin.para.NB", "border=0");
props.put("creole.imagePlugin.name", "ImageX");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -774,7 +774,7 @@ public class CreoleToJSPWikiTranslatorTest
props.load(new FileInputStream(TEST_PROPERTIES));
String src = "Hallo {{Image.png|Caption|M,[-]}}";
String target = "Hallo [{ImageX src='Image.png' caption='Caption' width='180' border=false}]";
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -784,7 +784,7 @@ public class CreoleToJSPWikiTranslatorTest
props.load(new FileInputStream(TEST_PROPERTIES));
String src = "Hallo [[http://www.gmx.de|{{Image.png||XL,+X,[-]}}]]";
String target = "Hallo [{ImageX src='Image.png' link='http://www.gmx.de' width='540' float='right' border=false}]";
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -794,7 +794,7 @@ public class CreoleToJSPWikiTranslatorTest
props.load(new FileInputStream(TEST_PROPERTIES));
String src = "Hallo [[http://www.gmx.de|{{Image.png||XL,+X,X-,[-]}}]]";
String target = "Hallo [{ImageX src='Image.png' link='http://www.gmx.de' width='540' float='right' align='left' border=false}]";
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -804,7 +804,7 @@ public class CreoleToJSPWikiTranslatorTest
props.load(new FileInputStream(TEST_PROPERTIES));
String src = "Hallo [[http://www.gmx.de|{{Image.png|Caption|XL,+X,X-,[-]}}]]";
String target = "Hallo [{ImageX src='Image.png' link='http://www.gmx.de' caption='Caption' width='540' float='right' align='left' border=false}]";
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -814,7 +814,7 @@ public class CreoleToJSPWikiTranslatorTest
props.load(new FileInputStream(TEST_PROPERTIES));
String src = "Hallo [[http://www.gmx.de|{{Image.png|Caption|xL, +X , X-, [-]}}]]";
String target = "Hallo [{ImageX src='Image.png' link='http://www.gmx.de' caption='Caption' width='540' float='right' align='left' border=false}]";
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -829,7 +829,7 @@ public class CreoleToJSPWikiTranslatorTest
props.put("creole.imagePlugin.para.%cm", "widthInCM='%'");
props.put("creole.imagePlugin.name", "ImageX");
- Assert.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
+ Assertions.assertEquals(target, new CreoleToJSPWikiTranslator().translate(props, src));
}
@Test
@@ -837,7 +837,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "<<JudoScript\r\n" + "if this works then ok\r\n" + "else improve the programm\r\n" + ">>";
String target = "[{JudoScript\r\n" + "if this works then ok\r\n" + "else improve the programm\r\n" + "}]";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -847,7 +847,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "**<<CurrentTimePlugin format='HH:mm \'am\' dd-MMM-yyyy'>>**";
String tar = "__[{CurrentTimePlugin format='HH:mm \'am\' dd-MMM-yyyy'}]__";
- Assert.assertEquals(tar, translate(src));
+ Assertions.assertEquals(tar, translate(src));
}
@Test
@@ -858,7 +858,7 @@ public class CreoleToJSPWikiTranslatorTest
String tar = "[{CurrentTimePlugin format=zzzz}]\r\n" + "\r\n" + "[{RecentChangesPlugin since='30'}]";
- Assert.assertEquals(tar, translate(src));
+ Assertions.assertEquals(tar, translate(src));
}
@Test
@@ -866,7 +866,7 @@ public class CreoleToJSPWikiTranslatorTest
{
String src = "<<JudoScript\r\n" + "if [[this]] works then ok\r\n" + "else improve the programm\r\n" + ">>";
String target = "[{JudoScript\r\n" + "if [[this]] works then ok\r\n" + "else improve the programm\r\n" + "}]";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@@ -876,7 +876,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "Hallo[[https://wiki.i3g.hs-heilbronn.de]]Hallo";
String target = "Hallo[https://wiki.i3g.hs-heilbronn.de]Hallo";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -885,7 +885,7 @@ public class CreoleToJSPWikiTranslatorTest
String src = "Hallo<<Hallo{{{Test}}}Hallo>>Hallo";
String target = "Hallo[{Hallo{{{Test}}}Hallo}]Hallo";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
@Test
@@ -895,7 +895,7 @@ public class CreoleToJSPWikiTranslatorTest
String target = "Hallo\r\n" + "[{Hallo\r\n" + "Hallo\r\n" + "Hallo\r\n" + "}]";
- Assert.assertEquals(target, translate(src));
+ Assertions.assertEquals(target, translate(src));
}
/**
@@ -916,14 +916,14 @@ public class CreoleToJSPWikiTranslatorTest
props.setProperty( "creole.imagePlugin.name", "Image" );
props.setProperty( "creole.imagePlugin.para.%px", "width='%px\"" );
- String content = "//Note: Please see the [[http://liferay.com/community/100-papercuts|main landing page]] for the latest updates.//<<TableOfContents>>== Introduction ==This project's aim is to identify and fix high-visibility, easy to correct bugs in Liferay Portal. It is driven by the wider Liferay community, with volunteers working to identify, prioritize, assign, and resolve known issues.== The Process ==# **Identify issues.** The community has always been encouraged to vote [...]
+ String content = "//Note: Please see the [[http://liferay.com/community/100-papercuts|main landing page]] for the latest updates.//<<TableOfContents>>== Introduction ==This project's aim is to identify and fix high-visibility, easy to correct bugs in Liferay Portal. It is driven by the wider Liferay community, with volunteers working to identify, prioritize, assign, and resolve known issues.== The Process ==# **Identify issues.** The community has always been encouraged to vote [...]
long startTime = System.currentTimeMillis();
translator.translate( props, content );
long testDuration = System.currentTimeMillis() - startTime;
// even a very slow cpu should do this much faster
- Assert.assertTrue( "rendering takes too long", testDuration < 3000 );
+ Assertions.assertTrue( testDuration < 3000, "rendering takes too long" );
}
public String translate(String src)
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java b/jspwiki-war/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
index 7d260de..f6dc49b 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/parser/JSPWikiMarkupParserTest.java
@@ -17,6 +17,7 @@
under the License.
*/
package org.apache.wiki.parser;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -40,10 +41,10 @@ import org.apache.wiki.providers.BasicAttachmentProvider;
import org.apache.wiki.render.XHTMLRenderer;
import org.apache.wiki.stress.Benchmark;
import org.apache.wiki.util.TextUtil;
-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 net.sf.ehcache.CacheManager;
@@ -56,7 +57,7 @@ public class JSPWikiMarkupParserTest
TestEngine testEngine;
- @Before
+ @BeforeEach
public void setUp()
throws Exception
{
@@ -66,7 +67,7 @@ public class JSPWikiMarkupParserTest
testEngine = new TestEngine( props );
}
- @After
+ @AfterEach
public void tearDown()
{
deleteCreatedPages();
@@ -161,7 +162,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [hyperlink]";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Hyperlink\">hyperlink</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Hyperlink\">hyperlink</a>",
translate(src) );
}
@@ -173,7 +174,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [hyperlink too]";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperlinkToo\">hyperlink too</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperlinkToo\">hyperlink too</a>",
translate(src) );
}
@@ -185,7 +186,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [HyperLink]";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>",
translate(src) );
}
@@ -197,7 +198,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [here|HyperLink]";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">here</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">here</a>",
translate(src) );
}
@@ -209,7 +210,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [here|HyperLink#heading]";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-Heading\">here</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-Heading\">here</a>",
translate(src) );
}
@@ -221,7 +222,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [HyperLink#heading]";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-Heading\">HyperLink#heading</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-Heading\">HyperLink#heading</a>",
translate(src) );
}
@@ -233,7 +234,7 @@ public class JSPWikiMarkupParserTest
String src = "!Heading Too\r\nThis should be a [HyperLink#heading too]";
- Assert.assertEquals( "<h4 id=\"section-testpage-HeadingToo\">Heading Too<a class=\"hashlink\" href=\"#section-testpage-HeadingToo\">#</a></h4>\nThis should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-HeadingToo\">HyperLink#heading too</a>",
+ Assertions.assertEquals( "<h4 id=\"section-testpage-HeadingToo\">Heading Too<a class=\"hashlink\" href=\"#section-testpage-HeadingToo\">#</a></h4>\nThis should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-HeadingToo\">HyperLink#heading too</a>",
translate(src) );
}
@@ -246,7 +247,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [HyperLink#headingwithnonASCIIZoltán]";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-HeadingwithnonASCIIZolt_E1n\">HyperLink#headingwithnonASCIIZoltán</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink#section-HyperLink-HeadingwithnonASCIIZolt_E1n\">HyperLink#headingwithnonASCIIZoltán</a>",
translate(src) );
}
@@ -263,7 +264,7 @@ public class JSPWikiMarkupParserTest
String src = "[DiscussionAboutWiki] [WikiMarkupDevelopment].";
- Assert.assertEquals( "<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=DiscussionAboutWiki\">DiscussionAboutWiki</a> <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=WikiMarkupDevelopment\">WikiMarkupDevelopment</a>.",
+ Assertions.assertEquals( "<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=DiscussionAboutWiki\">DiscussionAboutWiki</a> <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=WikiMarkupDevelopment\">WikiMarkupDevelopment</a>.",
translate(src) );
}
@@ -275,7 +276,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a HyperLink.";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>.",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>.",
translate(src) );
}
@@ -285,7 +286,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a HyperLink.";
- Assert.assertEquals( "This should be a <a class=\"createpage\" href=\"/test/Edit.jsp?page=HyperLink\" title=\"Create "HyperLink"\">HyperLink</a>.",
+ Assertions.assertEquals( "This should be a <a class=\"createpage\" href=\"/test/Edit.jsp?page=HyperLink\" title=\"Create "HyperLink"\">HyperLink</a>.",
translate(src) );
}
@@ -302,7 +303,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [ HyperLink ].";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\"> HyperLink </a>.",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\"> HyperLink </a>.",
translate(src) );
}
@@ -312,7 +313,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a nonHyperLink.";
- Assert.assertEquals( "This should be a nonHyperLink.",
+ Assertions.assertEquals( "This should be a nonHyperLink.",
translate(src) );
}
@@ -328,7 +329,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a HyperLink, and ThisToo.";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>, and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>, and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
translate(src) );
}
@@ -344,7 +345,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a [HyperLink], and ThisToo.";
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>, and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>, and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
translate(src) );
}
@@ -359,7 +360,7 @@ public class JSPWikiMarkupParserTest
String src = "] This ] should be a HyperLink], and ThisToo.";
- Assert.assertEquals( "] This ] should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>], and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
+ Assertions.assertEquals( "] This ] should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>], and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
translate(src) );
}
@@ -373,7 +374,7 @@ public class JSPWikiMarkupParserTest
String src = "HyperLink, and ThisToo";
- Assert.assertEquals( "<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>, and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>",
+ Assertions.assertEquals( "<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>, and <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>",
translate(src) );
}
@@ -386,7 +387,7 @@ public class JSPWikiMarkupParserTest
String src = "http://www.foo.bar/ANewHope/";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>",
+ Assertions.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>",
translate(src) );
}
@@ -399,7 +400,7 @@ public class JSPWikiMarkupParserTest
String src = "mailto:foo@bar.com";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "<a class=\"external\" href=\"mailto:foo@bar.com\">mailto:foo@bar.com</a>",
+ Assertions.assertEquals( "<a class=\"external\" href=\"mailto:foo@bar.com\">mailto:foo@bar.com</a>",
translate(src) );
}
@@ -412,7 +413,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a link: http://www.foo.bar/ANewHope/. Is it?";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "This should be a link: <a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>. Is it?",
+ Assertions.assertEquals( "This should be a link: <a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>. Is it?",
translate(src) );
}
@@ -425,7 +426,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a link: (http://www.foo.bar/ANewHope/) Is it?";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "This should be a link: (<a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>) Is it?",
+ Assertions.assertEquals( "This should be a link: (<a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>) Is it?",
translate(src) );
}
@@ -438,7 +439,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be a link: http://www.foo.bar/ANewHope/\nIs it?";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "This should be a link: <a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>\nIs it?",
+ Assertions.assertEquals( "This should be a link: <a class=\"external\" href=\"http://www.foo.bar/ANewHope/\">http://www.foo.bar/ANewHope/</a>\nIs it?",
translate(src) );
}
@@ -451,7 +452,7 @@ public class JSPWikiMarkupParserTest
String src = "This should not be a link: http://''some.server''/wiki//test/Wiki.jsp\nIs it?";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "This should not be a link: http://<i>some.server</i>/wiki//test/Wiki.jsp\nIs it?",
+ Assertions.assertEquals( "This should not be a link: http://<i>some.server</i>/wiki//test/Wiki.jsp\nIs it?",
translate(src) );
}
@@ -463,7 +464,7 @@ public class JSPWikiMarkupParserTest
String src = "http://www.foo.bar/ANewHope?q=foobar&gobble=bobble+gnoo";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/ANewHope?q=foobar&gobble=bobble+gnoo\">http://www.foo.bar/ANewHope?q=foobar&gobble=bobble+gnoo</a>",
+ Assertions.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/ANewHope?q=foobar&gobble=bobble+gnoo\">http://www.foo.bar/ANewHope?q=foobar&gobble=bobble+gnoo</a>",
translate(src) );
}
@@ -474,7 +475,7 @@ public class JSPWikiMarkupParserTest
String src = "http://www.foo.bar/~ANewHope/";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/~ANewHope/\">http://www.foo.bar/~ANewHope/</a>",
+ Assertions.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/~ANewHope/\">http://www.foo.bar/~ANewHope/</a>",
translate(src) );
}
@@ -485,7 +486,7 @@ public class JSPWikiMarkupParserTest
String src = "http://www.foo.bar/%7EANewHope/";
// System.out.println( "EX:"+translate(src) );
- Assert.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/%7EANewHope/\">http://www.foo.bar/%7EANewHope/</a>",
+ Assertions.assertEquals( "<a class=\"external\" href=\"http://www.foo.bar/%7EANewHope/\">http://www.foo.bar/%7EANewHope/</a>",
translate(src) );
}
@@ -495,7 +496,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should not be a ~HyperLink.";
- Assert.assertEquals( "This should not be a HyperLink.",
+ Assertions.assertEquals( "This should not be a HyperLink.",
translate(src) );
}
@@ -505,7 +506,7 @@ public class JSPWikiMarkupParserTest
{
String src = "~HyperLinks should not be matched.";
- Assert.assertEquals( "HyperLinks should not be matched.",
+ Assertions.assertEquals( "HyperLinks should not be matched.",
translate(src) );
}
@@ -515,7 +516,7 @@ public class JSPWikiMarkupParserTest
{
String src = "The page ~ASamplePage is not a hyperlink.";
- Assert.assertEquals( "The page ASamplePage is not a hyperlink.",
+ Assertions.assertEquals( "The page ASamplePage is not a hyperlink.",
translate(src) );
}
@@ -525,7 +526,7 @@ public class JSPWikiMarkupParserTest
{
String src = "The page \"~ASamplePage\" is not a hyperlink.";
- Assert.assertEquals( "The page "ASamplePage" is not a hyperlink.",
+ Assertions.assertEquals( "The page "ASamplePage" is not a hyperlink.",
translate(src) );
}
@@ -537,7 +538,7 @@ public class JSPWikiMarkupParserTest
String src = "*HyperLink";
- Assert.assertEquals( "<ul><li><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a></li></ul>",
+ Assertions.assertEquals( "<ul><li><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a></li></ul>",
translate(src) );
}
@@ -549,7 +550,7 @@ public class JSPWikiMarkupParserTest
String src = "__BoldHyperLink__";
- Assert.assertEquals( "<b><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=BoldHyperLink\">BoldHyperLink</a></b>",
+ Assertions.assertEquals( "<b><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=BoldHyperLink\">BoldHyperLink</a></b>",
translate(src) );
}
@@ -561,7 +562,7 @@ public class JSPWikiMarkupParserTest
String src = "Let's see, if a bold __HyperLink__ is correct?";
- Assert.assertEquals( "Let's see, if a bold <b><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a></b> is correct?",
+ Assertions.assertEquals( "Let's see, if a bold <b><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a></b> is correct?",
translate(src) );
}
@@ -573,7 +574,7 @@ public class JSPWikiMarkupParserTest
String src = "''ItalicHyperLink''";
- Assert.assertEquals( "<i><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ItalicHyperLink\">ItalicHyperLink</a></i>",
+ Assertions.assertEquals( "<i><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ItalicHyperLink\">ItalicHyperLink</a></i>",
translate(src) );
}
@@ -585,7 +586,7 @@ public class JSPWikiMarkupParserTest
String src = "Test. Punctuation. HyperLink.";
- Assert.assertEquals( "Test. Punctuation. <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>.",
+ Assertions.assertEquals( "Test. Punctuation. <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>.",
translate(src) );
}
@@ -598,7 +599,7 @@ public class JSPWikiMarkupParserTest
String src = "Punctuations: HyperLink,ThisToo.";
- Assert.assertEquals( "Punctuations: <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>,<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
+ Assertions.assertEquals( "Punctuations: <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLink</a>,<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=ThisToo\">ThisToo</a>.",
translate(src) );
}
@@ -610,7 +611,7 @@ public class JSPWikiMarkupParserTest
String src = "Onko t\u00e4m\u00e4 hyperlinkki: \u00c4itiSy\u00f6\u00d6ljy\u00e4?";
- Assert.assertEquals( "Onko t\u00e4m\u00e4 hyperlinkki: <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=%C4itiSy%F6%D6ljy%E4\">\u00c4itiSy\u00f6\u00d6ljy\u00e4</a>?",
+ Assertions.assertEquals( "Onko t\u00e4m\u00e4 hyperlinkki: <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=%C4itiSy%F6%D6ljy%E4\">\u00c4itiSy\u00f6\u00d6ljy\u00e4</a>?",
translate(src) );
}
@@ -621,7 +622,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a [http://www.regex.fi/]";
- Assert.assertEquals( "This should be a <a class=\"external\" href=\"http://www.regex.fi/\">http://www.regex.fi/</a>",
+ Assertions.assertEquals( "This should be a <a class=\"external\" href=\"http://www.regex.fi/\">http://www.regex.fi/</a>",
translate(src) );
}
@@ -631,7 +632,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a [link|http://www.regex.fi/]";
- Assert.assertEquals( "This should be a <a class=\"external\" href=\"http://www.regex.fi/\">link</a>",
+ Assertions.assertEquals( "This should be a <a class=\"external\" href=\"http://www.regex.fi/\">link</a>",
translate(src) );
}
@@ -641,7 +642,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a [link|http://www.regex.fi/]";
- Assert.assertEquals( "This should be a <a class=\"external\" href=\"http://www.regex.fi/\" rel=\"nofollow\">link</a>",
+ Assertions.assertEquals( "This should be a <a class=\"external\" href=\"http://www.regex.fi/\" rel=\"nofollow\">link</a>",
translate_nofollow(src) );
}
@@ -657,7 +658,7 @@ public class JSPWikiMarkupParserTest
newPage("HyperLink");
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLinks</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">HyperLinks</a>",
translate(src) );
}
@@ -667,7 +668,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a [HyperLinks]";
- Assert.assertEquals( "This should be a <a class=\"createpage\" href=\"/test/Edit.jsp?page=HyperLinks\" title=\"Create "HyperLinks"\">HyperLinks</a>",
+ Assertions.assertEquals( "This should be a <a class=\"createpage\" href=\"/test/Edit.jsp?page=HyperLinks\" title=\"Create "HyperLinks"\">HyperLinks</a>",
translate(src) );
}
@@ -679,7 +680,7 @@ public class JSPWikiMarkupParserTest
newPage("HyperLinks");
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLinks\">HyperLink</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLinks\">HyperLink</a>",
translate(src) );
}
@@ -691,7 +692,7 @@ public class JSPWikiMarkupParserTest
newPage("HyperLink");
- Assert.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">Hyper links</a>",
+ Assertions.assertEquals( "This should be a <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=HyperLink\">Hyper links</a>",
translate(src) );
}
@@ -702,7 +703,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a [link|http://www.haxored.com/\" onMouseOver=\"alert('Hahhaa');\"]";
- Assert.assertEquals( "This should be a <a class=\"external\" href=\"http://www.haxored.com/" onMouseOver="alert('Hahhaa');"\">link</a>",
+ Assertions.assertEquals( "This should be a <a class=\"external\" href=\"http://www.haxored.com/" onMouseOver="alert('Hahhaa');"\">link</a>",
translate(src) );
}
@@ -712,7 +713,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a [link|JSPWiki:HyperLink]";
- Assert.assertEquals( "This should be a <a class=\"interwiki\" href=\"http://jspwiki-wiki.apache.org/Wiki.jsp?page=HyperLink\">link</a>",
+ Assertions.assertEquals( "This should be a <a class=\"interwiki\" href=\"http://jspwiki-wiki.apache.org/Wiki.jsp?page=HyperLink\">link</a>",
translate(src) );
}
@@ -722,7 +723,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should be a [JSPWiki:HyperLink]";
- Assert.assertEquals( "This should be a <a class=\"interwiki\" href=\"http://jspwiki-wiki.apache.org/Wiki.jsp?page=HyperLink\">JSPWiki:HyperLink</a>",
+ Assertions.assertEquals( "This should be a <a class=\"interwiki\" href=\"http://jspwiki-wiki.apache.org/Wiki.jsp?page=HyperLink\">JSPWiki:HyperLink</a>",
translate(src) );
}
@@ -738,7 +739,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be an [attachment link|Test/TestAtt.txt]";
- Assert.assertEquals( "This should be an <a class=\"attachment\" href=\"/test/attach/Test/TestAtt.txt\">attachment link</a>"+
+ Assertions.assertEquals( "This should be an <a class=\"attachment\" href=\"/test/attach/Test/TestAtt.txt\">attachment link</a>"+
"<a href=\"/test/PageInfo.jsp?page=Test/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>",
translate(src));
}
@@ -762,7 +763,7 @@ public class JSPWikiMarkupParserTest
String src = "This should be an [attachment link|Test/TestAtt.txt]";
- Assert.assertEquals( "This should be an <a class=\"attachment\" href=\"/test/attach/Test/TestAtt.txt\">attachment link</a>"+
+ Assertions.assertEquals( "This should be an <a class=\"attachment\" href=\"/test/attach/Test/TestAtt.txt\">attachment link</a>"+
"<a href=\"/test/PageInfo.jsp?page=Test/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>",
translate(testEngine2,src));
}
@@ -786,7 +787,7 @@ public class JSPWikiMarkupParserTest
String src = "[Test page/TestAtt.txt]";
- Assert.assertEquals( "<a class=\"attachment\" href=\"/test/attach/TestPage/TestAtt.txt\">Test page/TestAtt.txt</a>"+
+ Assertions.assertEquals( "<a class=\"attachment\" href=\"/test/attach/TestPage/TestAtt.txt\">Test page/TestAtt.txt</a>"+
"<a href=\"/test/PageInfo.jsp?page=TestPage/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>",
translate(testEngine2,src));
}
@@ -807,7 +808,7 @@ public class JSPWikiMarkupParserTest
String src = "["+testEngine2.beautifyTitle("TestPage/TestAtt.txt")+"]";
- Assert.assertEquals( "<a class=\"attachment\" href=\"/test/attach/TestPage/TestAtt.txt\">Test Page/TestAtt.txt</a>"+
+ Assertions.assertEquals( "<a class=\"attachment\" href=\"/test/attach/TestPage/TestAtt.txt\">Test Page/TestAtt.txt</a>"+
"<a href=\"/test/PageInfo.jsp?page=TestPage/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>",
translate(testEngine2,src));
}
@@ -820,7 +821,7 @@ public class JSPWikiMarkupParserTest
String src = "This should not be a [[HyperLink]";
- Assert.assertEquals( "This should not be a [HyperLink]",
+ Assertions.assertEquals( "This should not be a [HyperLink]",
translate(src) );
}
@@ -830,7 +831,7 @@ public class JSPWikiMarkupParserTest
{
String src = "This should not be a [[[[HyperLink]";
- Assert.assertEquals( "This should not be a [[[HyperLink]",
+ Assertions.assertEquals( "This should not be a [[[HyperLink]",
translate(src) );
}
@@ -840,7 +841,7 @@ public class JSPWikiMarkupParserTest
{
String src = "[[HyperLink], and this [[Neither].";
- Assert.assertEquals( "[HyperLink], and this [Neither].",
+ Assertions.assertEquals( "[HyperLink], and this [Neither].",
translate(src) );
}
@@ -850,7 +851,7 @@ public class JSPWikiMarkupParserTest
{
String src = "There is [[{NoPlugin}] here.";
- Assert.assertEquals( "There is [{NoPlugin}] here.",
+ Assertions.assertEquals( "There is [{NoPlugin}] here.",
translate(src) );
}
@@ -860,7 +861,7 @@ public class JSPWikiMarkupParserTest
{
String src = "What if this is the last char [";
- Assert.assertEquals( "What if this is the last char ",
+ Assertions.assertEquals( "What if this is the last char ",
translate(src) );
}
@@ -870,7 +871,7 @@ public class JSPWikiMarkupParserTest
{
String src = "What if this is the last char [[";
- Assert.assertEquals( "What if this is the last char [",
+ Assertions.assertEquals( "What if this is the last char [",
translate(src) );
}
@@ -882,7 +883,7 @@ public class JSPWikiMarkupParserTest
newPage("Test_page");
- Assert.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Test_page\">test_page</a>",
+ Assertions.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Test_page\">test_page</a>",
translate(src) );
}
@@ -894,7 +895,7 @@ public class JSPWikiMarkupParserTest
newPage("Test.page");
- Assert.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Test.page\">test.page</a>",
+ Assertions.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Test.page\">test.page</a>",
translate(src) );
}
@@ -906,7 +907,7 @@ public class JSPWikiMarkupParserTest
newPage(".testpage_");
- Assert.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=.testpage_\">.testpage_</a>",
+ Assertions.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=.testpage_\">.testpage_</a>",
translate(src) );
}
@@ -916,7 +917,7 @@ public class JSPWikiMarkupParserTest
{
String src = "Link [test|http://www.ecyrd.com/test.png]";
- Assert.assertEquals("Link <img class=\"inline\" src=\"http://www.ecyrd.com/test.png\" alt=\"test\" />",
+ Assertions.assertEquals("Link <img class=\"inline\" src=\"http://www.ecyrd.com/test.png\" alt=\"test\" />",
translate(src) );
}
@@ -926,7 +927,7 @@ public class JSPWikiMarkupParserTest
{
String src = "Link [test|http://www.ecyrd.com/test.ppm]";
- Assert.assertEquals("Link <a class=\"external\" href=\"http://www.ecyrd.com/test.ppm\">test</a>",
+ Assertions.assertEquals("Link <a class=\"external\" href=\"http://www.ecyrd.com/test.ppm\">test</a>",
translate(src) );
}
@@ -936,7 +937,7 @@ public class JSPWikiMarkupParserTest
{
String src = "Link [test|http://images.com/testi]";
- Assert.assertEquals("Link <img class=\"inline\" src=\"http://images.com/testi\" alt=\"test\" />",
+ Assertions.assertEquals("Link <img class=\"inline\" src=\"http://images.com/testi\" alt=\"test\" />",
translate(src) );
}
@@ -946,7 +947,7 @@ public class JSPWikiMarkupParserTest
{
String src = "Link [test|http://foobar.jpg]";
- Assert.assertEquals("Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"test\" />",
+ Assertions.assertEquals("Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"test\" />",
translate(src) );
}
@@ -957,7 +958,7 @@ public class JSPWikiMarkupParserTest
{
String src = "Link [http://foobar.jpg]";
- Assert.assertEquals("Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://foobar.jpg\" />",
+ Assertions.assertEquals("Link <img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://foobar.jpg\" />",
translate(src) );
}
@@ -967,7 +968,7 @@ public class JSPWikiMarkupParserTest
{
String src = "Link [http://link.to/|http://foobar.jpg]";
- Assert.assertEquals("Link <a class=\"external\" href=\"http://link.to/\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://link.to/\" /></a>",
+ Assertions.assertEquals("Link <a class=\"external\" href=\"http://link.to/\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"http://link.to/\" /></a>",
translate(src) );
}
@@ -979,7 +980,7 @@ public class JSPWikiMarkupParserTest
newPage("SandBox");
- Assert.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=SandBox\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"SandBox\" /></a>",
+ Assertions.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=SandBox\"><img class=\"inline\" src=\"http://foobar.jpg\" alt=\"SandBox\" /></a>",
translate(src) );
}
@@ -991,7 +992,7 @@ public class JSPWikiMarkupParserTest
newPage("\u00C5\u00E4Test"); // FIXME: Should be capital
- Assert.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=%C5%E4Test\">\u00c5\u00e4Test</a>",
+ Assertions.assertEquals("Link <a class=\"wikipage\" href=\"/test/Wiki.jsp?page=%C5%E4Test\">\u00c5\u00e4Test</a>",
translate(src));
}
@@ -1001,7 +1002,7 @@ public class JSPWikiMarkupParserTest
{
String src = "1\n\n2\n\n3";
- Assert.assertEquals( "<p>1\n</p><p>2\n</p>\n<p>3</p>", translate(src) );
+ Assertions.assertEquals( "<p>1\n</p><p>2\n</p>\n<p>3</p>", translate(src) );
}
@Test
@@ -1012,7 +1013,7 @@ public class JSPWikiMarkupParserTest
newPage( "WikiEtiquette" );
- Assert.assertEquals( "<p><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=WikiEtiquette\">WikiEtiquette</a>\n</p>"+
+ Assertions.assertEquals( "<p><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=WikiEtiquette\">WikiEtiquette</a>\n</p>"+
"<p><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Search\">Search</a></p>", translate(src) );
}
@@ -1022,7 +1023,7 @@ public class JSPWikiMarkupParserTest
{
String src = "\r\n\r\n!Testi\r\n\r\nFoo.";
- Assert.assertEquals( "<p />\n<h4 id=\"section-testpage-Testi\">Testi<a class=\"hashlink\" href=\"#section-testpage-Testi\">#</a></h4>\n<p>Foo.</p>",
+ Assertions.assertEquals( "<p />\n<h4 id=\"section-testpage-Testi\">Testi<a class=\"hashlink\" href=\"#section-testpage-Testi\">#</a></h4>\n<p>Foo.</p>",
translate(src) );
}
@@ -1037,7 +1038,7 @@ public class JSPWikiMarkupParserTest
newPage("Search");
newPage("UnusedPages");
- Assert.assertEquals( "<p><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=RecentChanges\">Recent Changes</a><br />\n"+
+ Assertions.assertEquals( "<p><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=RecentChanges\">Recent Changes</a><br />\n"+
"<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=WikiEtiquette\">WikiEtiquette</a>\n</p>\n"+
"<p><a class=\"wikipage\" href=\"/test/Wiki.jsp?page=Search\">Find pages</a><br />\n"+
"<a class=\"wikipage\" href=\"/test/Wiki.jsp?page=UnusedPages\">Unused pages</a></p>",
@@ -1050,7 +1051,7 @@ public class JSPWikiMarkupParserTest
String src = "__File type sniffing__ is a way of identifying the content type of a document.\n\n"+
"In UNIX, the file(1) command can be used.";
- Assert.assertEquals( "<p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>"+
+ Assertions.assertEquals( "<p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>"+
"<p>In UNIX, the file(1) command can be used.</p>",
translate(src) );
}
@@ -1061,7 +1062,7 @@ public class JSPWikiMarkupParserTest
String src = "[{Counter}]\n\n__File type sniffing__ is a way of identifying the content type of a document.\n\n"+
"In UNIX, the file(1) command can be used.";
- Assert.assertEquals( "<p>1\n</p><p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>\n"+
+ Assertions.assertEquals( "<p>1\n</p><p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>\n"+
"<p>In UNIX, the file(1) command can be used.</p>",
translate(src) );
}
@@ -1072,7 +1073,7 @@ public class JSPWikiMarkupParserTest
String src = "[{$encoding}]\n\n__File type sniffing__ is a way of identifying the content type of a document.\n\n"+
"In UNIX, the file(1) command can be used.";
- Assert.assertEquals( "<p>ISO-8859-1\n</p><p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>\n"+
+ Assertions.assertEquals( "<p>ISO-8859-1\n</p><p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>\n"+
"<p>In UNIX, the file(1) command can be used.</p>",
translate(src) );
}
@@ -1083,7 +1084,7 @@ public class JSPWikiMarkupParserTest
String src = "[{SET foo=bar}]\n\n__File type sniffing__ is a way of identifying the content type of a document.\n\n"+
"In UNIX, the file(1) command can be used.";
- Assert.assertEquals( "<p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>\n"+
+ Assertions.assertEquals( "<p><b>File type sniffing</b> is a way of identifying the content type of a document.\n</p>\n"+
"<p>In UNIX, the file(1) command can be used.</p>",
translate(src) );
}
@@ -1094,7 +1095,7 @@ public class JSPWikiMarkupParserTest
{
... 8384 lines suppressed ...