@@ -97,8 +97,7 @@ public void monoWhenPermitAllThenSuccess() {
97
97
@ Test
98
98
public void monoPreAuthorizeHasRoleWhenGrantedThenSuccess () {
99
99
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 );
102
101
StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
103
102
}
104
103
@@ -113,16 +112,15 @@ public void monoPreAuthorizeHasRoleWhenNoAuthenticationThenDenied() {
113
112
@ Test
114
113
public void monoPreAuthorizeHasRoleWhenNotAuthorizedThenDenied () {
115
114
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 );
118
116
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
119
117
this .result .assertNoSubscribers ();
120
118
}
121
119
122
120
@ Test
123
121
public void monoPreAuthorizeBeanWhenGrantedThenSuccess () {
124
122
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 );
126
124
StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
127
125
}
128
126
@@ -144,29 +142,29 @@ public void monoPreAuthorizeBeanWhenNoAuthenticationThenDenied() {
144
142
@ Test
145
143
public void monoPreAuthorizeBeanWhenNotAuthorizedThenDenied () {
146
144
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 );
148
146
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
149
147
this .result .assertNoSubscribers ();
150
148
}
151
149
152
150
@ Test
153
151
public void monoPostAuthorizeWhenAuthorizedThenSuccess () {
154
152
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 );
156
154
StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
157
155
}
158
156
159
157
@ Test
160
158
public void monoPostAuthorizeWhenNotAuthorizedThenDenied () {
161
159
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 );
163
161
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
164
162
}
165
163
166
164
@ Test
167
165
public void monoPostAuthorizeWhenBeanAndAuthorizedThenSuccess () {
168
166
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 );
170
168
StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
171
169
}
172
170
@@ -180,7 +178,7 @@ public void monoPostAuthorizeWhenBeanAndNotAuthenticatedAndAuthorizedThenSuccess
180
178
@ Test
181
179
public void monoPostAuthorizeWhenBeanAndNotAuthorizedThenDenied () {
182
180
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 );
184
182
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
185
183
}
186
184
@@ -201,8 +199,7 @@ public void fluxWhenPermitAllThenSuccess() {
201
199
@ Test
202
200
public void fluxPreAuthorizeHasRoleWhenGrantedThenSuccess () {
203
201
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 );
206
203
StepVerifier .create (findById ).consumeNextWith ((s ) -> assertThat (s ).isEqualTo ("result" )).verifyComplete ();
207
204
}
208
205
@@ -217,16 +214,15 @@ public void fluxPreAuthorizeHasRoleWhenNoAuthenticationThenDenied() {
217
214
@ Test
218
215
public void fluxPreAuthorizeHasRoleWhenNotAuthorizedThenDenied () {
219
216
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 );
222
218
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
223
219
this .result .assertNoSubscribers ();
224
220
}
225
221
226
222
@ Test
227
223
public void fluxPreAuthorizeBeanWhenGrantedThenSuccess () {
228
224
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 );
230
226
StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
231
227
}
232
228
@@ -248,29 +244,29 @@ public void fluxPreAuthorizeBeanWhenNoAuthenticationThenDenied() {
248
244
@ Test
249
245
public void fluxPreAuthorizeBeanWhenNotAuthorizedThenDenied () {
250
246
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 );
252
248
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
253
249
this .result .assertNoSubscribers ();
254
250
}
255
251
256
252
@ Test
257
253
public void fluxPostAuthorizeWhenAuthorizedThenSuccess () {
258
254
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 );
260
256
StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
261
257
}
262
258
263
259
@ Test
264
260
public void fluxPostAuthorizeWhenNotAuthorizedThenDenied () {
265
261
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 );
267
263
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
268
264
}
269
265
270
266
@ Test
271
267
public void fluxPostAuthorizeWhenBeanAndAuthorizedThenSuccess () {
272
268
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 );
274
270
StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
275
271
}
276
272
@@ -284,7 +280,7 @@ public void fluxPostAuthorizeWhenBeanAndNotAuthenticatedAndAuthorizedThenSuccess
284
280
@ Test
285
281
public void fluxPostAuthorizeWhenBeanAndNotAuthorizedThenDenied () {
286
282
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 );
288
284
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
289
285
}
290
286
@@ -306,7 +302,7 @@ public void publisherWhenPermitAllThenSuccess() {
306
302
public void publisherPreAuthorizeHasRoleWhenGrantedThenSuccess () {
307
303
given (this .delegate .publisherPreAuthorizeHasRoleFindById (1L )).willReturn (publisherJust ("result" ));
308
304
Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeHasRoleFindById (1L ))
309
- .subscriberContext (this .withAdmin );
305
+ .contextWrite (this .withAdmin );
310
306
StepVerifier .create (findById ).consumeNextWith ((s ) -> assertThat (s ).isEqualTo ("result" )).verifyComplete ();
311
307
}
312
308
@@ -322,7 +318,7 @@ public void publisherPreAuthorizeHasRoleWhenNoAuthenticationThenDenied() {
322
318
public void publisherPreAuthorizeHasRoleWhenNotAuthorizedThenDenied () {
323
319
given (this .delegate .publisherPreAuthorizeHasRoleFindById (1L )).willReturn (this .result );
324
320
Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeHasRoleFindById (1L ))
325
- .subscriberContext (this .withUser );
321
+ .contextWrite (this .withUser );
326
322
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
327
323
this .result .assertNoSubscribers ();
328
324
}
@@ -331,7 +327,7 @@ public void publisherPreAuthorizeHasRoleWhenNotAuthorizedThenDenied() {
331
327
public void publisherPreAuthorizeBeanWhenGrantedThenSuccess () {
332
328
given (this .delegate .publisherPreAuthorizeBeanFindById (2L )).willReturn (publisherJust ("result" ));
333
329
Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeBeanFindById (2L ))
334
- .subscriberContext (this .withAdmin );
330
+ .contextWrite (this .withAdmin );
335
331
StepVerifier .create (findById ).expectNext ("result" ).verifyComplete ();
336
332
}
337
333
@@ -354,7 +350,7 @@ public void publisherPreAuthorizeBeanWhenNoAuthenticationThenDenied() {
354
350
public void publisherPreAuthorizeBeanWhenNotAuthorizedThenDenied () {
355
351
given (this .delegate .publisherPreAuthorizeBeanFindById (1L )).willReturn (this .result );
356
352
Publisher <String > findById = Flux .from (this .messageService .publisherPreAuthorizeBeanFindById (1L ))
357
- .subscriberContext (this .withUser );
353
+ .contextWrite (this .withUser );
358
354
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
359
355
this .result .assertNoSubscribers ();
360
356
}
@@ -363,23 +359,23 @@ public void publisherPreAuthorizeBeanWhenNotAuthorizedThenDenied() {
363
359
public void publisherPostAuthorizeWhenAuthorizedThenSuccess () {
364
360
given (this .delegate .publisherPostAuthorizeFindById (1L )).willReturn (publisherJust ("user" ));
365
361
Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeFindById (1L ))
366
- .subscriberContext (this .withUser );
362
+ .contextWrite (this .withUser );
367
363
StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
368
364
}
369
365
370
366
@ Test
371
367
public void publisherPostAuthorizeWhenNotAuthorizedThenDenied () {
372
368
given (this .delegate .publisherPostAuthorizeBeanFindById (1L )).willReturn (publisherJust ("not-authorized" ));
373
369
Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeBeanFindById (1L ))
374
- .subscriberContext (this .withUser );
370
+ .contextWrite (this .withUser );
375
371
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
376
372
}
377
373
378
374
@ Test
379
375
public void publisherPostAuthorizeWhenBeanAndAuthorizedThenSuccess () {
380
376
given (this .delegate .publisherPostAuthorizeBeanFindById (2L )).willReturn (publisherJust ("user" ));
381
377
Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeBeanFindById (2L ))
382
- .subscriberContext (this .withUser );
378
+ .contextWrite (this .withUser );
383
379
StepVerifier .create (findById ).expectNext ("user" ).verifyComplete ();
384
380
}
385
381
@@ -394,7 +390,7 @@ public void publisherPostAuthorizeWhenBeanAndNotAuthenticatedAndAuthorizedThenSu
394
390
public void publisherPostAuthorizeWhenBeanAndNotAuthorizedThenDenied () {
395
391
given (this .delegate .publisherPostAuthorizeBeanFindById (1L )).willReturn (publisherJust ("not-authorized" ));
396
392
Publisher <String > findById = Flux .from (this .messageService .publisherPostAuthorizeBeanFindById (1L ))
397
- .subscriberContext (this .withUser );
393
+ .contextWrite (this .withUser );
398
394
StepVerifier .create (findById ).expectError (AccessDeniedException .class ).verify ();
399
395
}
400
396
0 commit comments