Skip to content

Commit

Permalink
fix checkstle import order
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed May 6, 2022
1 parent ce7ec6a commit 71f1f9c
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.apereo.cas.authentication.policy;

import javax.security.auth.login.AccountNotFoundException;
import org.apereo.cas.authentication.CoreAuthenticationTestUtils;

import lombok.val;
Expand All @@ -9,6 +8,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;

import javax.security.auth.login.AccountNotFoundException;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
Expand All @@ -30,11 +30,11 @@ public class GroovyScriptAuthenticationPolicyTests {
@Test
public void verifyActionExternalScript() throws Exception {
val script = "import org.apereo.cas.authentication.*\n"
+ "def run(Object[] args) {"
+ " def principal = args[0]\n"
+ " def logger = args[1]\n"
+ " return Optional.of(new AuthenticationException())\n"
+ '}';
+ "def run(Object[] args) {"
+ " def principal = args[0]\n"
+ " def logger = args[1]\n"
+ " return Optional.of(new AuthenticationException())\n"
+ '}';

val scriptFile = new File(FileUtils.getTempDirectoryPath(), "script.groovy");
FileUtils.write(scriptFile, script, StandardCharsets.UTF_8);
Expand All @@ -47,9 +47,9 @@ public void verifyActionExternalScript() throws Exception {
@Test
public void verifyResumeOnFailureExternal() throws Exception {
val script = "def shouldResumeOnFailure(Object[] args) {"
+ " def failure = args[0] \n"
+ " return failure != null \n"
+ '}';
+ " def failure = args[0] \n"
+ " return failure != null \n"
+ '}';

val scriptFile = new File(FileUtils.getTempDirectoryPath(), "script.groovy");
FileUtils.write(scriptFile, script, StandardCharsets.UTF_8);
Expand All @@ -67,9 +67,9 @@ public void verifyResumeOnFailureClasspath() {
@Test
public void verifyBadFile() throws Exception {
val script = "def shouldResumeOnFailure(Object[] args) {"
+ " def failure = args[0] \n"
+ " return failure != null \n"
+ '}';
+ " def failure = args[0] \n"
+ " return failure != null \n"
+ '}';
val p = new GroovyScriptAuthenticationPolicy(script);
assertThrows(IllegalArgumentException.class, () -> p.shouldResumeOnFailure(new RuntimeException()));
}
Expand Down

0 comments on commit 71f1f9c

Please sign in to comment.