@@ -244,61 +244,29 @@ public void untested_spec208_blackbox_mustBePreparedToReceiveOnNextSignalsAfterH
244
244
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.9
245
245
@ Override @ Test
246
246
public void required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall () throws Throwable {
247
- blackboxSubscriberWithoutSetupTest (new BlackboxTestStageTestRun () {
248
- @ Override
247
+ blackboxSubscriberTest (new BlackboxTestStageTestRun () {
248
+ @ Override @ SuppressWarnings ( "ThrowableResultOfMethodCallIgnored" )
249
249
public void run (BlackboxTestStage stage ) throws Throwable {
250
- final Publisher <T > pub = new Publisher <T >() {
251
- @ Override public void subscribe (final Subscriber <? super T > s ) {
252
- s .onSubscribe (new Subscription () {
253
- private boolean completed = false ;
254
-
255
- @ Override public void request (long n ) {
256
- if (!completed ) {
257
- completed = true ;
258
- s .onComplete (); // Publisher now realises that it is in fact already completed
259
- }
260
- }
261
-
262
- @ Override public void cancel () {
263
- // noop, ignore
264
- }
265
- });
266
- }
267
- };
268
-
269
- final Subscriber <T > sub = createSubscriber ();
270
- final BlackboxSubscriberProxy <T > probe = stage .createBlackboxSubscriberProxy (env , sub );
271
-
272
- pub .subscribe (probe );
250
+ final Subscriber <? super T > sub = stage .sub ();
251
+
273
252
triggerRequest (sub );
274
- probe .expectCompletion ();
275
- probe .expectNone ();
276
-
277
- env .verifyNoAsyncErrorsNoDelay ();
253
+ final long notUsed = stage .expectRequest (); // received request signal
254
+ sub .onComplete ();
255
+ stage .subProxy ().expectCompletion ();
278
256
}
279
257
});
280
258
}
281
259
282
260
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.9
283
261
@ Override @ Test
284
262
public void required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall () throws Throwable {
285
- blackboxSubscriberWithoutSetupTest (new BlackboxTestStageTestRun () {
286
- @ Override
263
+ blackboxSubscriberTest (new BlackboxTestStageTestRun () {
264
+ @ Override @ SuppressWarnings ( "ThrowableResultOfMethodCallIgnored" )
287
265
public void run (BlackboxTestStage stage ) throws Throwable {
288
- final Publisher <T > pub = new Publisher <T >() {
289
- @ Override
290
- public void subscribe (Subscriber <? super T > s ) {
291
- s .onComplete ();
292
- }
293
- };
294
-
295
- final Subscriber <T > sub = createSubscriber ();
296
- final BlackboxSubscriberProxy <T > probe = stage .createBlackboxSubscriberProxy (env , sub );
297
-
298
- pub .subscribe (probe );
299
- probe .expectCompletion ();
266
+ final Subscriber <? super T > sub = stage .sub ();
300
267
301
- env .verifyNoAsyncErrorsNoDelay ();
268
+ sub .onComplete ();
269
+ stage .subProxy ().expectCompletion ();
302
270
}
303
271
});
304
272
}
@@ -307,9 +275,25 @@ public void subscribe(Subscriber<? super T> s) {
307
275
@ Override @ Test
308
276
public void required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall () throws Throwable {
309
277
blackboxSubscriberTest (new BlackboxTestStageTestRun () {
310
- @ Override
311
- @ SuppressWarnings ("ThrowableResultOfMethodCallIgnored" )
278
+ @ Override @ SuppressWarnings ("ThrowableResultOfMethodCallIgnored" )
279
+ public void run (BlackboxTestStage stage ) throws Throwable {
280
+ final Subscriber <? super T > sub = stage .sub ();
281
+
282
+ triggerRequest (sub );
283
+ final long notUsed = stage .expectRequest (); // received request signal
284
+ sub .onError (new TestException ()); // in response to that, we fail
285
+ stage .subProxy ().expectError (Throwable .class );
286
+ }
287
+ });
288
+ }
289
+
290
+ // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.10
291
+ @ Override @ Test
292
+ public void required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall () throws Throwable {
293
+ blackboxSubscriberTest (new BlackboxTestStageTestRun () {
294
+ @ Override @ SuppressWarnings ("ThrowableResultOfMethodCallIgnored" )
312
295
public void run (BlackboxTestStage stage ) throws Throwable {
296
+
313
297
stage .sub ().onError (new TestException ());
314
298
stage .subProxy ().expectError (Throwable .class );
315
299
}
0 commit comments