|
@@ -34,6 +34,7 @@ import reactor.test.StepVerifier;
|
|
|
import reactor.test.publisher.TestPublisher;
|
|
|
import reactor.util.context.Context;
|
|
|
|
|
|
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|
|
import static org.mockito.Mockito.*;
|
|
|
|
|
|
/**
|
|
@@ -60,6 +61,14 @@ public class EnableReactiveMethodSecurityTests {
|
|
|
this.delegate = config.delegate;
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void notPublisherPreAuthorizeFindByIdThenThrowsIllegalStateException() {
|
|
|
+ assertThatThrownBy(() -> this.messageService.notPublisherPreAuthorizeFindById(1L))
|
|
|
+ .isInstanceOf(IllegalStateException.class)
|
|
|
+ .extracting(Throwable::getMessage)
|
|
|
+ .contains("The returnType class java.lang.String on public abstract java.lang.String org.springframework.security.config.annotation.method.configuration.ReactiveMessageService.notPublisherPreAuthorizeFindById(long) must return an instance of org.reactivestreams.Publisher (i.e. Mono / Flux) in order to support Reactor Context");
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void monoWhenPermitAllThenAopDoesNotSubscribe() {
|
|
|
when(this.delegate.monoFindById(1L)).thenReturn(Mono.from(result));
|