use of org.springframework.security.access.prepost.PreInvocationAttribute in project spring-security by spring-projects.
the class ExpressionBasedPreInvocationAdviceTests method findFilterTargetNameNotProvided.
@Test
public void findFilterTargetNameNotProvided() throws Exception {
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class, "doSomethingCollection", new Class[] { List.class }, new Object[] { new ArrayList<>() });
boolean result = this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute);
assertThat(result).isTrue();
}
use of org.springframework.security.access.prepost.PreInvocationAttribute in project spring-security by spring-projects.
the class ExpressionBasedPreInvocationAdviceTests method findFilterTargetNameProvidedArrayUnsupported.
@Test
public void findFilterTargetNameProvidedArrayUnsupported() throws Exception {
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "param", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class, "doSomethingArray", new Class[] { String[].class }, new Object[] { new String[0] });
assertThatIllegalArgumentException().isThrownBy(() -> this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute));
}
use of org.springframework.security.access.prepost.PreInvocationAttribute in project spring-security by spring-projects.
the class ExpressionBasedPreInvocationAdviceTests method findFilterTargetNameNotProvidedMethodAcceptMoreThenOneArgument.
@Test
public void findFilterTargetNameNotProvidedMethodAcceptMoreThenOneArgument() throws Exception {
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class, "doSomethingTwoArgs", new Class[] { String.class, List.class }, new Object[] { "param", new ArrayList<>() });
assertThatIllegalArgumentException().isThrownBy(() -> this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute));
}
use of org.springframework.security.access.prepost.PreInvocationAttribute in project spring-security by spring-projects.
the class ExpressionBasedPreInvocationAdviceTests method findFilterTargetNameProvided.
@Test
public void findFilterTargetNameProvided() throws Exception {
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "param", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class, "doSomethingCollection", new Class[] { List.class }, new Object[] { new ArrayList<>() });
boolean result = this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute);
assertThat(result).isTrue();
}
use of org.springframework.security.access.prepost.PreInvocationAttribute in project spring-security by spring-projects.
the class ExpressionBasedPreInvocationAdviceTests method findFilterTargetNameNotProvidedArrayUnsupported.
@Test
public void findFilterTargetNameNotProvidedArrayUnsupported() throws Exception {
PreInvocationAttribute attribute = new PreInvocationExpressionAttribute("true", "", null);
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class, "doSomethingArray", new Class[] { String[].class }, new Object[] { new String[0] });
assertThatIllegalArgumentException().isThrownBy(() -> this.expressionBasedPreInvocationAdvice.before(this.authentication, methodInvocation, attribute));
}
Aggregations