Skip to content
Snippets Groups Projects
Commit 39f21d31 authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XCOMMONS-1561: IsolatedTestRunner fails to run on Java 10+

* stop using IsolatedTestRunner
* enable back ignored tests
parent 527fd2e5
No related branches found
No related tags found
No related merge requests found
......@@ -24,11 +24,8 @@
import java.util.Set;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.xwiki.model.EntityType;
import org.xwiki.security.AbstractSecurityTestCase;
import org.xwiki.test.isolation.IsolatedTestRunner;
import org.xwiki.test.isolation.IsolatedClassPrefix;
import static org.xwiki.security.authorization.RuleState.ALLOW;
import static org.xwiki.security.authorization.RuleState.DENY;
......@@ -39,8 +36,6 @@
* @version $Id$
* @since 4.0M2
*/
@RunWith(IsolatedTestRunner.class)
@IsolatedClassPrefix("org.xwiki.security")
public abstract class AbstractAdditionalRightsTestCase extends AbstractSecurityTestCase
{
private static class TestRightDescription implements RightDescription
......
......@@ -22,7 +22,7 @@
import java.util.Collections;
import java.util.Set;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.xwiki.model.EntityType;
......@@ -38,19 +38,14 @@
*/
class RightTest
{
class CustomRight implements RightDescription
static class FooRight implements RightDescription
{
private String name;
CustomRight(String name)
{
this.name = name;
}
final static String NAME = "foo";
@Override
public String getName()
{
return this.name;
return NAME;
}
@Override
......@@ -88,6 +83,20 @@ public boolean isReadOnly()
{
return true;
}
static void unregister()
{
Right fooRight = Right.toRight("foo");
if (fooRight != Right.ILLEGAL) {
fooRight.unregister();
}
}
}
@AfterEach
void afterEach()
{
FooRight.unregister();
}
@Test
......@@ -98,22 +107,20 @@ void toRight()
assertSame(Right.ILLEGAL, Right.toRight("notexist"));
}
@Disabled("Disabled because it breaks the DefaultAuthorizationManagerIntegrationTest since Rights are static.")
@Test
void constructorWithImpliedByRight()
{
assertNull(Right.VIEW.getImpliedRights());
Right myRight = new Right(new CustomRight("foo"), Collections.singleton(Right.VIEW));
Right myRight = new Right(new FooRight(), Collections.singleton(Right.VIEW));
assertSame(Right.toRight("foo"), myRight);
assertEquals(Collections.singleton(myRight), Right.VIEW.getImpliedRights());
}
@Disabled("Disabled because it breaks the DefaultAuthorizationManagerIntegrationTest since Rights are static.")
@Test
void like()
{
Right myRight = new Right(new CustomRight("foo"));
assertTrue(myRight.like(new CustomRight("foo")));
Right myRight = new Right(new FooRight());
assertTrue(myRight.like(new FooRight()));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment