17
17
package org .springframework .security .config .annotation .method .configuration ;
18
18
19
19
import static org .assertj .core .api .Assertions .assertThat ;
20
- import static org .mockito .Mockito .mock ;
21
20
22
21
import org .junit .Rule ;
23
22
import org .junit .Test ;
@@ -44,12 +43,12 @@ public class ReactiveMethodSecurityConfigurationTests {
44
43
DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler ;
45
44
46
45
@ Test
47
- public void rolePrefixWithGrantedAuthorityDefaults () {
46
+ public void rolePrefixWithGrantedAuthorityDefaults () throws NoSuchMethodException {
48
47
this .spring .register (WithRolePrefixConfiguration .class ).autowire ();
49
48
50
49
TestingAuthenticationToken authentication = new TestingAuthenticationToken (
51
50
"principal" , "credential" , "CUSTOM_ABC" );
52
- MockMethodInvocation methodInvocation = mock ( MockMethodInvocation .class );
51
+ MockMethodInvocation methodInvocation = new MockMethodInvocation ( new Foo (), Foo . class , "bar" , String .class );
53
52
54
53
EvaluationContext context = this .methodSecurityExpressionHandler
55
54
.createEvaluationContext (authentication , methodInvocation );
@@ -63,12 +62,12 @@ public void rolePrefixWithGrantedAuthorityDefaults() {
63
62
}
64
63
65
64
@ Test
66
- public void rolePrefixWithDefaultConfig () {
65
+ public void rolePrefixWithDefaultConfig () throws NoSuchMethodException {
67
66
this .spring .register (ReactiveMethodSecurityConfiguration .class ).autowire ();
68
67
69
68
TestingAuthenticationToken authentication = new TestingAuthenticationToken (
70
69
"principal" , "credential" , "ROLE_ABC" );
71
- MockMethodInvocation methodInvocation = mock ( MockMethodInvocation .class );
70
+ MockMethodInvocation methodInvocation = new MockMethodInvocation ( new Foo (), Foo . class , "bar" , String .class );
72
71
73
72
EvaluationContext context = this .methodSecurityExpressionHandler
74
73
.createEvaluationContext (authentication , methodInvocation );
@@ -89,12 +88,12 @@ GrantedAuthorityDefaults grantedAuthorityDefaults() {
89
88
}
90
89
91
90
@ Test
92
- public void rolePrefixWithGrantedAuthorityDefaultsAndSubclassWithProxyingEnabled () {
91
+ public void rolePrefixWithGrantedAuthorityDefaultsAndSubclassWithProxyingEnabled () throws NoSuchMethodException {
93
92
this .spring .register (SubclassConfig .class ).autowire ();
94
93
95
94
TestingAuthenticationToken authentication = new TestingAuthenticationToken (
96
95
"principal" , "credential" , "ROLE_ABC" );
97
- MockMethodInvocation methodInvocation = mock ( MockMethodInvocation .class );
96
+ MockMethodInvocation methodInvocation = new MockMethodInvocation ( new Foo (), Foo . class , "bar" , String .class );
98
97
99
98
EvaluationContext context = this .methodSecurityExpressionHandler
100
99
.createEvaluationContext (authentication , methodInvocation );
@@ -108,4 +107,9 @@ public void rolePrefixWithGrantedAuthorityDefaultsAndSubclassWithProxyingEnabled
108
107
@ Configuration
109
108
static class SubclassConfig extends ReactiveMethodSecurityConfiguration {
110
109
}
110
+
111
+ private static class Foo {
112
+ public void bar (String param ){
113
+ }
114
+ }
111
115
}
0 commit comments