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 03192b330f6b3a85dc28d259da5a1ba05d6c6dbc Author: juanpablo <[email protected]> AuthorDate: Fri Dec 6 18:34:09 2019 +0100 refactor test so that testEngine doesn't get garbage collected - should fix ocassional test failures --- .../java/org/apache/wiki/ui/PageCommandTest.java | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/jspwiki-main/src/test/java/org/apache/wiki/ui/PageCommandTest.java b/jspwiki-main/src/test/java/org/apache/wiki/ui/PageCommandTest.java index b1ed7d9..a5a7b83 100644 --- a/jspwiki-main/src/test/java/org/apache/wiki/ui/PageCommandTest.java +++ b/jspwiki-main/src/test/java/org/apache/wiki/ui/PageCommandTest.java @@ -25,27 +25,11 @@ package org.apache.wiki.ui; import org.apache.wiki.TestEngine; import org.apache.wiki.WikiPage; import org.apache.wiki.auth.permissions.PermissionFactory; -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 PageCommandTest { - TestEngine testEngine = TestEngine.build(); - WikiPage testPage; - - @BeforeEach - public void setUp() throws Exception { - testEngine.saveText( "TestPage", "This is a test." ); - testPage = testEngine.getPage( "TestPage" ); - } - - @AfterEach - public void tearDown() throws Exception { - testEngine.deletePage( "TestPage" ); - } - @Test public void testStaticCommand() { Command a = PageCommand.VIEW; @@ -77,7 +61,11 @@ public class PageCommandTest { } @Test - public void testTargetedCommand() { + public void testTargetedCommand() throws Exception { + final TestEngine testEngine = TestEngine.build(); + testEngine.saveText( "TestPage", "This is a test." ); + final WikiPage testPage = testEngine.getPage( "TestPage" ); + // Get view command Command a = PageCommand.VIEW;
