@@ -97,8 +97,7 @@ public void monoWhenPermitAllThenSuccess() {
9797 @ Test
9898 public void monoPreAuthorizeHasRoleWhenGrantedThenSuccess () {
9999 given (this .delegate .monoPreAuthorizeHasRoleFindById (1L )).willReturn (Mono .just ("result" ));
100- Mono <String > findById = this .messageService .monoPreAuthorizeHasRoleFindById (1L )
101- .subscriberContext (this .withAdmin );
100+ Mono <String > findById = this .messageService .monoPreAuthorizeHasRoleFindById (1L ).contextWrite (this .withAdmin );
102101 StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
103102 }
104103
@@ -113,16 +112,15 @@ public void monoPreAuthorizeHasRoleWhenNoAuthenticationThenDenied() {
113112 @ Test
114113 public void monoPreAuthorizeHasRoleWhenNotAuthorizedThenDenied () {
115114 given (this .delegate .monoPreAuthorizeHasRoleFindById (1L )).willReturn (Mono .from (this .result ));
116- Mono <String > findById = this .messageService .monoPreAuthorizeHasRoleFindById (1L )
117- .subscriberContext (this .withUser );
115+ Mono <String > findById = this .messageService .monoPreAuthorizeHasRoleFindById (1L ).contextWrite (this .withUser );
118116 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
119117 this .result .assertNoSubscribers ();
120118 }
121119
122120 @ Test
123121 public void monoPreAuthorizeBeanWhenGrantedThenSuccess () {
124122 given (this .delegate .monoPreAuthorizeBeanFindById (2L )).willReturn (Mono .just ("result" ));
125- Mono <String > findById = this .messageService .monoPreAuthorizeBeanFindById (2L ).subscriberContext (this .withAdmin );
123+ Mono <String > findById = this .messageService .monoPreAuthorizeBeanFindById (2L ).contextWrite (this .withAdmin );
126124 StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
127125 }
128126
@@ -144,29 +142,29 @@ public void monoPreAuthorizeBeanWhenNoAuthenticationThenDenied() {
144142 @ Test
145143 public void monoPreAuthorizeBeanWhenNotAuthorizedThenDenied () {
146144 given (this .delegate .monoPreAuthorizeBeanFindById (1L )).willReturn (Mono .from (this .result ));
147- Mono <String > findById = this .messageService .monoPreAuthorizeBeanFindById (1L ).subscriberContext (this .withUser );
145+ Mono <String > findById = this .messageService .monoPreAuthorizeBeanFindById (1L ).contextWrite (this .withUser );
148146 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
149147 this .result .assertNoSubscribers ();
150148 }
151149
152150 @ Test
153151 public void monoPostAuthorizeWhenAuthorizedThenSuccess () {
154152 given (this .delegate .monoPostAuthorizeFindById (1L )).willReturn (Mono .just ("user" ));
155- Mono <String > findById = this .messageService .monoPostAuthorizeFindById (1L ).subscriberContext (this .withUser );
153+ Mono <String > findById = this .messageService .monoPostAuthorizeFindById (1L ).contextWrite (this .withUser );
156154 StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
157155 }
158156
159157 @ Test
160158 public void monoPostAuthorizeWhenNotAuthorizedThenDenied () {
161159 given (this .delegate .monoPostAuthorizeBeanFindById (1L )).willReturn (Mono .just ("not-authorized" ));
162- Mono <String > findById = this .messageService .monoPostAuthorizeBeanFindById (1L ).subscriberContext (this .withUser );
160+ Mono <String > findById = this .messageService .monoPostAuthorizeBeanFindById (1L ).contextWrite (this .withUser );
163161 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
164162 }
165163
166164 @ Test
167165 public void monoPostAuthorizeWhenBeanAndAuthorizedThenSuccess () {
168166 given (this .delegate .monoPostAuthorizeBeanFindById (2L )).willReturn (Mono .just ("user" ));
169- Mono <String > findById = this .messageService .monoPostAuthorizeBeanFindById (2L ).subscriberContext (this .withUser );
167+ Mono <String > findById = this .messageService .monoPostAuthorizeBeanFindById (2L ).contextWrite (this .withUser );
170168 StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
171169 }
172170
@@ -180,7 +178,7 @@ public void monoPostAuthorizeWhenBeanAndNotAuthenticatedAndAuthorizedThenSuccess
180178 @ Test
181179 public void monoPostAuthorizeWhenBeanAndNotAuthorizedThenDenied () {
182180 given (this .delegate .monoPostAuthorizeBeanFindById (1L )).willReturn (Mono .just ("not-authorized" ));
183- Mono <String > findById = this .messageService .monoPostAuthorizeBeanFindById (1L ).subscriberContext (this .withUser );
181+ Mono <String > findById = this .messageService .monoPostAuthorizeBeanFindById (1L ).contextWrite (this .withUser );
184182 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
185183 }
186184
@@ -201,8 +199,7 @@ public void fluxWhenPermitAllThenSuccess() {
201199 @ Test
202200 public void fluxPreAuthorizeHasRoleWhenGrantedThenSuccess () {
203201 given (this .delegate .fluxPreAuthorizeHasRoleFindById (1L )).willReturn (Flux .just ("result" ));
204- Flux <String > findById = this .messageService .fluxPreAuthorizeHasRoleFindById (1L )
205- .subscriberContext (this .withAdmin );
202+ Flux <String > findById = this .messageService .fluxPreAuthorizeHasRoleFindById (1L ).contextWrite (this .withAdmin );
206203 StepVerifier .create (findById ).consumeNextWith ((s ) -> assertThat (s ).isEqualTo ("result" )).verifyComplete ();
207204 }
208205
@@ -217,16 +214,15 @@ public void fluxPreAuthorizeHasRoleWhenNoAuthenticationThenDenied() {
217214 @ Test
218215 public void fluxPreAuthorizeHasRoleWhenNotAuthorizedThenDenied () {
219216 given (this .delegate .fluxPreAuthorizeHasRoleFindById (1L )).willReturn (Flux .from (this .result ));
220- Flux <String > findById = this .messageService .fluxPreAuthorizeHasRoleFindById (1L )
221- .subscriberContext (this .withUser );
217+ Flux <String > findById = this .messageService .fluxPreAuthorizeHasRoleFindById (1L ).contextWrite (this .withUser );
222218 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
223219 this .result .assertNoSubscribers ();
224220 }
225221
226222 @ Test
227223 public void fluxPreAuthorizeBeanWhenGrantedThenSuccess () {
228224 given (this .delegate .fluxPreAuthorizeBeanFindById (2L )).willReturn (Flux .just ("result" ));
229- Flux <String > findById = this .messageService .fluxPreAuthorizeBeanFindById (2L ).subscriberContext (this .withAdmin );
225+ Flux <String > findById = this .messageService .fluxPreAuthorizeBeanFindById (2L ).contextWrite (this .withAdmin );
230226 StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
231227 }
232228
@@ -248,29 +244,29 @@ public void fluxPreAuthorizeBeanWhenNoAuthenticationThenDenied() {
248244 @ Test
249245 public void fluxPreAuthorizeBeanWhenNotAuthorizedThenDenied () {
250246 given (this .delegate .fluxPreAuthorizeBeanFindById (1L )).willReturn (Flux .from (this .result ));
251- Flux <String > findById = this .messageService .fluxPreAuthorizeBeanFindById (1L ).subscriberContext (this .withUser );
247+ Flux <String > findById = this .messageService .fluxPreAuthorizeBeanFindById (1L ).contextWrite (this .withUser );
252248 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
253249 this .result .assertNoSubscribers ();
254250 }
255251
256252 @ Test
257253 public void fluxPostAuthorizeWhenAuthorizedThenSuccess () {
258254 given (this .delegate .fluxPostAuthorizeFindById (1L )).willReturn (Flux .just ("user" ));
259- Flux <String > findById = this .messageService .fluxPostAuthorizeFindById (1L ).subscriberContext (this .withUser );
255+ Flux <String > findById = this .messageService .fluxPostAuthorizeFindById (1L ).contextWrite (this .withUser );
260256 StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
261257 }
262258
263259 @ Test
264260 public void fluxPostAuthorizeWhenNotAuthorizedThenDenied () {
265261 given (this .delegate .fluxPostAuthorizeBeanFindById (1L )).willReturn (Flux .just ("not-authorized" ));
266- Flux <String > findById = this .messageService .fluxPostAuthorizeBeanFindById (1L ).subscriberContext (this .withUser );
262+ Flux <String > findById = this .messageService .fluxPostAuthorizeBeanFindById (1L ).contextWrite (this .withUser );
267263 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
268264 }
269265
270266 @ Test
271267 public void fluxPostAuthorizeWhenBeanAndAuthorizedThenSuccess () {
272268 given (this .delegate .fluxPostAuthorizeBeanFindById (2L )).willReturn (Flux .just ("user" ));
273- Flux <String > findById = this .messageService .fluxPostAuthorizeBeanFindById (2L ).subscriberContext (this .withUser );
269+ Flux <String > findById = this .messageService .fluxPostAuthorizeBeanFindById (2L ).contextWrite (this .withUser );
274270 StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
275271 }
276272
@@ -284,7 +280,7 @@ public void fluxPostAuthorizeWhenBeanAndNotAuthenticatedAndAuthorizedThenSuccess
284280 @ Test
285281 public void fluxPostAuthorizeWhenBeanAndNotAuthorizedThenDenied () {
286282 given (this .delegate .fluxPostAuthorizeBeanFindById (1L )).willReturn (Flux .just ("not-authorized" ));
287- Flux <String > findById = this .messageService .fluxPostAuthorizeBeanFindById (1L ).subscriberContext (this .withUser );
283+ Flux <String > findById = this .messageService .fluxPostAuthorizeBeanFindById (1L ).contextWrite (this .withUser );
288284 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
289285 }
290286
@@ -306,7 +302,7 @@ public void publisherWhenPermitAllThenSuccess() {
306302 public void publisherPreAuthorizeHasRoleWhenGrantedThenSuccess () {
307303 given (this .delegate .publisherPreAuthorizeHasRoleFindById (1L )).willReturn (publisherJust ("result" ));
308304 Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeHasRoleFindById (1L ))
309- .subscriberContext (this .withAdmin );
305+ .contextWrite (this .withAdmin );
310306 StepVerifier .create (findById ).consumeNextWith ((s ) -> assertThat (s ).isEqualTo ("result" )).verifyComplete ();
311307 }
312308
@@ -322,7 +318,7 @@ public void publisherPreAuthorizeHasRoleWhenNoAuthenticationThenDenied() {
322318 public void publisherPreAuthorizeHasRoleWhenNotAuthorizedThenDenied () {
323319 given (this .delegate .publisherPreAuthorizeHasRoleFindById (1L )).willReturn (this .result );
324320 Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeHasRoleFindById (1L ))
325- .subscriberContext (this .withUser );
321+ .contextWrite (this .withUser );
326322 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
327323 this .result .assertNoSubscribers ();
328324 }
@@ -331,7 +327,7 @@ public void publisherPreAuthorizeHasRoleWhenNotAuthorizedThenDenied() {
331327 public void publisherPreAuthorizeBeanWhenGrantedThenSuccess () {
332328 given (this .delegate .publisherPreAuthorizeBeanFindById (2L )).willReturn (publisherJust ("result" ));
333329 Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeBeanFindById (2L ))
334- .subscriberContext (this .withAdmin );
330+ .contextWrite (this .withAdmin );
335331 StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
336332 }
337333
@@ -354,7 +350,7 @@ public void publisherPreAuthorizeBeanWhenNoAuthenticationThenDenied() {
354350 public void publisherPreAuthorizeBeanWhenNotAuthorizedThenDenied () {
355351 given (this .delegate .publisherPreAuthorizeBeanFindById (1L )).willReturn (this .result );
356352 Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeBeanFindById (1L ))
357- .subscriberContext (this .withUser );
353+ .contextWrite (this .withUser );
358354 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
359355 this .result .assertNoSubscribers ();
360356 }
@@ -363,23 +359,23 @@ public void publisherPreAuthorizeBeanWhenNotAuthorizedThenDenied() {
363359 public void publisherPostAuthorizeWhenAuthorizedThenSuccess () {
364360 given (this .delegate .publisherPostAuthorizeFindById (1L )).willReturn (publisherJust ("user" ));
365361 Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeFindById (1L ))
366- .subscriberContext (this .withUser );
362+ .contextWrite (this .withUser );
367363 StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
368364 }
369365
370366 @ Test
371367 public void publisherPostAuthorizeWhenNotAuthorizedThenDenied () {
372368 given (this .delegate .publisherPostAuthorizeBeanFindById (1L )).willReturn (publisherJust ("not-authorized" ));
373369 Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeBeanFindById (1L ))
374- .subscriberContext (this .withUser );
370+ .contextWrite (this .withUser );
375371 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
376372 }
377373
378374 @ Test
379375 public void publisherPostAuthorizeWhenBeanAndAuthorizedThenSuccess () {
380376 given (this .delegate .publisherPostAuthorizeBeanFindById (2L )).willReturn (publisherJust ("user" ));
381377 Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeBeanFindById (2L ))
382- .subscriberContext (this .withUser );
378+ .contextWrite (this .withUser );
383379 StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
384380 }
385381
@@ -394,7 +390,7 @@ public void publisherPostAuthorizeWhenBeanAndNotAuthenticatedAndAuthorizedThenSu
394390 public void publisherPostAuthorizeWhenBeanAndNotAuthorizedThenDenied () {
395391 given (this .delegate .publisherPostAuthorizeBeanFindById (1L )).willReturn (publisherJust ("not-authorized" ));
396392 Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeBeanFindById (1L ))
397- .subscriberContext (this .withUser );
393+ .contextWrite (this .withUser );
398394 StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
399395 }
400396
0 commit comments