diff --git a/impl/core/src/test/java/security/authorization/custom/CustomAuthorizer.java b/impl/core/src/test/java/security/authorization/custom/CustomAuthorizer.java index da41133..6daa3ef 100644 --- a/impl/core/src/test/java/security/authorization/custom/CustomAuthorizer.java +++ b/impl/core/src/test/java/security/authorization/custom/CustomAuthorizer.java @@ -51,7 +51,4 @@ public class CustomAuthorizer implements Authorizer { public boolean hasPermission(String resource, String operation) { return "resource".equals(resource) && "operation".equals(operation); } - - - } diff --git a/impl/core/src/test/java/security/authorization/custom/CustomAuthorizerTest.java b/impl/core/src/test/java/security/authorization/custom/CustomAuthorizerTest.java index 0625abe..487ba52 100644 --- a/impl/core/src/test/java/security/authorization/custom/CustomAuthorizerTest.java +++ b/impl/core/src/test/java/security/authorization/custom/CustomAuthorizerTest.java @@ -36,9 +36,10 @@ */ package security.authorization.custom; -import javax.inject.Inject; +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertTrue; -import junit.framework.Assert; +import javax.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; @@ -66,44 +67,43 @@ public class CustomAuthorizerTest { deployment.addClass(CustomAuthorizer.class); return deployment; } - + @Before - public void loginToTest(){ + public void loginToTest() { context.login(); } @Test - public void hasPermission(){ - Assert.assertTrue(context.hasPermission("resource", "operation")); + public void hasPermission() { + assertTrue(context.hasPermission("resource", "operation")); } - + @Test - public void hasRole(){ - Assert.assertTrue(context.hasRole("role")); + public void hasRole() { + assertTrue(context.hasRole("role")); } - + /** * Verify if when already exist an authorizer, the things keeps working fine. */ @Test - public void hasPermitionAndHasRole(){ - Assert.assertTrue(context.hasPermission("resource", "operation")); - Assert.assertTrue(context.hasRole("role")); + public void hasPermitionAndHasRole() { + assertTrue(context.hasPermission("resource", "operation")); + assertTrue(context.hasRole("role")); } - + @Test - public void denyPermission(){ - Assert.assertFalse(context.hasPermission("falseresource", "falseoperation")); + public void denyPermission() { + assertFalse(context.hasPermission("falseresource", "falseoperation")); } - + @Test - public void denyRole(){ - Assert.assertFalse(context.hasRole("falserole")); + public void denyRole() { + assertFalse(context.hasRole("falserole")); } - + @After - public void logoutAfterTest(){ + public void logoutAfterTest() { context.logout(); } - } diff --git a/impl/core/src/test/java/security/authorization/disable/DisabledAuthorizationTest.java b/impl/core/src/test/java/security/authorization/disable/DisabledAuthorizationTest.java index ed658da..48b8e99 100644 --- a/impl/core/src/test/java/security/authorization/disable/DisabledAuthorizationTest.java +++ b/impl/core/src/test/java/security/authorization/disable/DisabledAuthorizationTest.java @@ -36,14 +36,13 @@ */ package security.authorization.disable; +import static junit.framework.Assert.assertTrue; import static org.junit.Assert.assertNull; import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; import javax.inject.Inject; -import junit.framework.Assert; - import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.spec.JavaArchive; @@ -69,10 +68,8 @@ public class DisabledAuthorizationTest { @Deployment public static JavaArchive createDeployment() { - JavaArchive deployment = Tests.createDeployment(ConfigurationResourceTest.class); - deployment.addClass(CustomAuthorizer.class); - deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); - return deployment; + return Tests.createDeployment(ConfigurationResourceTest.class).addClasses(CustomAuthorizer.class) + .addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); } public void observer(@Observes AfterLoginSuccessful event) { @@ -81,15 +78,15 @@ public class DisabledAuthorizationTest { @Test public void hasPermissionProcess() { - Assert.assertTrue(context.hasPermission("resource", "operation")); - Assert.assertTrue(context.hasPermission("falseresource", "falseoperation")); + assertTrue(context.hasPermission("resource", "operation")); + assertTrue(context.hasPermission("falseresource", "falseoperation")); assertNull(event); } @Test - public void hasRoleProcess(){ - Assert.assertTrue(context.hasRole("role")); - Assert.assertTrue(context.hasRole("falserole")); + public void hasRoleProcess() { + assertTrue(context.hasRole("role")); + assertTrue(context.hasRole("falserole")); assertNull(event); } } -- libgit2 0.21.2