18
18
19
19
import com .mongodb .assertions .Assertions ;
20
20
import com .mongodb .lang .NonNull ;
21
- import com .mongodb .lang .Nullable ;
22
21
23
22
import java .util .ArrayList ;
24
23
import java .util .Arrays ;
34
33
import static com .mongodb .client .unified .UnifiedTestModifications .Modifier .SLEEP_AFTER_CURSOR_CLOSE ;
35
34
import static com .mongodb .client .unified .UnifiedTestModifications .Modifier .SLEEP_AFTER_CURSOR_OPEN ;
36
35
import static com .mongodb .client .unified .UnifiedTestModifications .Modifier .WAIT_FOR_BATCH_CURSOR_CREATION ;
37
- import static org .junit .jupiter .api .Assumptions .assumeFalse ;
38
36
39
37
public final class UnifiedTestModifications {
40
38
public static void doSkips (final TestDef def ) {
@@ -90,7 +88,7 @@ public static void doSkips(final TestDef def) {
90
88
// added as part of https://jira.mongodb.org/browse/JAVA-4976 , but unknown Jira to complete
91
89
// The implementation of the functionality related to clearing the connection pool before closing the connection
92
90
// will be carried out once the specification is finalized and ready.
93
- def .skipTodo ("" )
91
+ def .skipUnknownReason ("" )
94
92
.test ("connection-monitoring-and-pooling/logging" , "connection-logging" , "Connection checkout fails due to error establishing connection" );
95
93
96
94
// load-balancers
@@ -129,7 +127,7 @@ public static void doSkips(final TestDef def) {
129
127
.test ("crud" , "count" , "Deprecated count without a filter" )
130
128
.test ("crud" , "count" , "Deprecated count with a filter" )
131
129
.test ("crud" , "count" , "Deprecated count with skip and limit" );
132
- def .skipTodo ("See downstream changes comment on https://jira.mongodb.org/browse/JAVA-4275" )
130
+ def .skipUnknownReason ("See downstream changes comment on https://jira.mongodb.org/browse/JAVA-4275" )
133
131
.test ("crud" , "findOneAndReplace-hint-unacknowledged" , "Unacknowledged findOneAndReplace with hint string on 4.4+ server" )
134
132
.test ("crud" , "findOneAndReplace-hint-unacknowledged" , "Unacknowledged findOneAndReplace with hint document on 4.4+ server" )
135
133
.test ("crud" , "findOneAndUpdate-hint-unacknowledged" , "Unacknowledged findOneAndUpdate with hint string on 4.4+ server" )
@@ -292,54 +290,54 @@ private TestDef(final String dir, final String file, final String test, final bo
292
290
* Test is skipped because it is pending implementation, and there is
293
291
* a Jira ticket tracking this which has more information.
294
292
*
295
- * @param skip reason for skipping the test; must start with a Jira URL
293
+ * @param ticket reason for skipping the test; must start with a Jira URL
296
294
*/
297
- public TestApplicator skipJira (final String skip ) {
298
- Assertions .assertTrue (skip .startsWith ("https://jira.mongodb.org/browse/JAVA-" ));
299
- return new TestApplicator (this , skip );
295
+ public TestApplicator skipJira (final String ticket ) {
296
+ Assertions .assertTrue (ticket .startsWith ("https://jira.mongodb.org/browse/JAVA-" ));
297
+ return new TestApplicator (this , ticket );
300
298
}
301
299
302
300
/**
303
301
* Test is skipped because the feature under test was deprecated, and
304
302
* was removed in the Java driver.
305
303
*
306
- * @param skip reason for skipping the test
304
+ * @param reason reason for skipping the test
307
305
*/
308
- public TestApplicator skipDeprecated (final String skip ) {
309
- return new TestApplicator (this , skip );
306
+ public TestApplicator skipDeprecated (final String reason ) {
307
+ return new TestApplicator (this , reason );
310
308
}
311
309
312
310
/**
313
311
* Test is skipped because the Java driver cannot comply with the spec.
314
312
*
315
- * @param skip reason for skipping the test
313
+ * @param reason reason for skipping the test
316
314
*/
317
- public TestApplicator skipNoncompliant (final String skip ) {
318
- return new TestApplicator (this , skip );
315
+ public TestApplicator skipNoncompliant (final String reason ) {
316
+ return new TestApplicator (this , reason );
319
317
}
320
318
321
319
/**
322
320
* Test is skipped because the Java Reactive driver cannot comply with the spec.
323
321
*
324
- * @param skip reason for skipping the test
322
+ * @param reason reason for skipping the test
325
323
*/
326
- public TestApplicator skipNoncompliantReactive (final String skip ) {
327
- return new TestApplicator (this , skip );
324
+ public TestApplicator skipNoncompliantReactive (final String reason ) {
325
+ return new TestApplicator (this , reason );
328
326
}
329
327
330
328
/**
331
329
* The test is skipped, as specified. This should be paired with a
332
330
* "when" clause.
333
331
*/
334
- public TestApplicator skipAccordingToSpec (final String skip ) {
335
- return new TestApplicator (this , skip );
332
+ public TestApplicator skipAccordingToSpec (final String reason ) {
333
+ return new TestApplicator (this , reason );
336
334
}
337
335
338
336
/**
339
337
* The test is skipped for an unknown reason.
340
338
*/
341
- public TestApplicator skipTodo (final String skip ) {
342
- return new TestApplicator (this , skip );
339
+ public TestApplicator skipUnknownReason (final String reason ) {
340
+ return new TestApplicator (this , reason );
343
341
}
344
342
345
343
public TestApplicator modify (final Modifier ... modifiers ) {
@@ -360,10 +358,6 @@ public boolean wasAssignedModifier(final Modifier modifier) {
360
358
*/
361
359
public static final class TestApplicator {
362
360
private final TestDef testDef ;
363
-
364
- private final boolean shouldSkip ;
365
- @ Nullable
366
- private final String reasonToApply ;
367
361
private final List <Modifier > modifiersToApply ;
368
362
private Supplier <Boolean > precondition ;
369
363
private boolean matchWasPerformed = false ;
@@ -372,32 +366,24 @@ private TestApplicator(
372
366
final TestDef testDef ,
373
367
final List <Modifier > modifiersToApply ) {
374
368
this .testDef = testDef ;
375
- this .shouldSkip = false ;
376
- this .reasonToApply = null ;
377
369
this .modifiersToApply = modifiersToApply ;
378
370
}
379
371
380
372
private TestApplicator (
381
373
final TestDef testDef ,
382
374
@ NonNull
383
- final String reason ) {
375
+ final String skipReason ) {
384
376
this .testDef = testDef ;
385
- this .shouldSkip = true ;
386
- this .reasonToApply = reason ;
387
- this .modifiersToApply = new ArrayList <>();
377
+ this .modifiersToApply = Arrays .asList (Modifier .SKIP );
388
378
}
389
379
390
380
private TestApplicator onMatch (final boolean match ) {
391
381
matchWasPerformed = true ;
392
382
if (precondition != null && !precondition .get ()) {
393
383
return this ;
394
384
}
395
- if (shouldSkip ) {
396
- assumeFalse (match , reasonToApply );
397
- } else {
398
- if (match ) {
399
- this .testDef .modifiers .addAll (this .modifiersToApply );
400
- }
385
+ if (match ) {
386
+ this .testDef .modifiers .addAll (this .modifiersToApply );
401
387
}
402
388
return this ;
403
389
}
@@ -510,5 +496,9 @@ public enum Modifier {
510
496
* Reactive only.
511
497
*/
512
498
WAIT_FOR_BATCH_CURSOR_CREATION ,
499
+ /**
500
+ * Skip the test.
501
+ */
502
+ SKIP ,
513
503
}
514
504
}
0 commit comments