From e25117856e294b2088c228ded12eb9ef9ca78d10 Mon Sep 17 00:00:00 2001 From: Marcus Da Coregio Date: Tue, 11 Apr 2023 09:56:19 -0300 Subject: [PATCH] Add static imports to code snippets Closes gh-6597 --- .../ROOT/pages/reactive/test/web/authentication.adoc | 3 +++ docs/modules/ROOT/pages/reactive/test/web/csrf.adoc | 4 ++++ docs/modules/ROOT/pages/reactive/test/web/setup.adoc | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/docs/modules/ROOT/pages/reactive/test/web/authentication.adoc b/docs/modules/ROOT/pages/reactive/test/web/authentication.adoc index 897356789c..18e69d1068 100644 --- a/docs/modules/ROOT/pages/reactive/test/web/authentication.adoc +++ b/docs/modules/ROOT/pages/reactive/test/web/authentication.adoc @@ -7,6 +7,8 @@ For example: .Java [source,java,role="primary"] ---- +import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.mockUser; + @Test public void messageWhenNotAuthenticated() throws Exception { this.rest @@ -67,6 +69,7 @@ public void messageWhenMutateWithMockAdminThenOk() throws Exception { [source,kotlin,role="secondary"] ---- import org.springframework.test.web.reactive.server.expectBody +import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.mockUser //... diff --git a/docs/modules/ROOT/pages/reactive/test/web/csrf.adoc b/docs/modules/ROOT/pages/reactive/test/web/csrf.adoc index da3b917c35..6846449c9e 100644 --- a/docs/modules/ROOT/pages/reactive/test/web/csrf.adoc +++ b/docs/modules/ROOT/pages/reactive/test/web/csrf.adoc @@ -7,6 +7,8 @@ For example: .Java [source,java,role="primary"] ---- +import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf; + this.rest // provide a valid CSRF token .mutateWith(csrf()) @@ -18,6 +20,8 @@ this.rest .Kotlin [source,kotlin,role="secondary"] ---- +import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf + this.rest // provide a valid CSRF token .mutateWith(csrf()) diff --git a/docs/modules/ROOT/pages/reactive/test/web/setup.adoc b/docs/modules/ROOT/pages/reactive/test/web/setup.adoc index 51adc6936d..fac5ca177f 100644 --- a/docs/modules/ROOT/pages/reactive/test/web/setup.adoc +++ b/docs/modules/ROOT/pages/reactive/test/web/setup.adoc @@ -6,6 +6,9 @@ The basic setup looks like this: .Java [source,java,role="primary"] ---- +import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.springSecurity; +import static org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication; + @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = HelloWebfluxMethodApplication.class) public class HelloWebfluxMethodApplicationTests { @@ -31,6 +34,9 @@ public class HelloWebfluxMethodApplicationTests { .Kotlin [source,kotlin,role="secondary"] ---- +import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.springSecurity +import org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication + @ExtendWith(SpringExtension::class) @ContextConfiguration(classes = [HelloWebfluxMethodApplication::class]) class HelloWebfluxMethodApplicationTests {