@@ -40,37 +40,113 @@ private[scala] trait HookDsl extends BaseScalaDsl {
40
40
41
41
}
42
42
43
+ /**
44
+ * Defines an before hook.
45
+ */
43
46
def Before : HookBody = Before (EMPTY_TAG_EXPRESSION , DEFAULT_BEFORE_ORDER )
44
47
48
+ /**
49
+ * Defines an before hook.
50
+ *
51
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
52
+ */
45
53
def Before (tagExpression : String ): HookBody = Before (tagExpression, DEFAULT_BEFORE_ORDER )
46
54
55
+ /**
56
+ * Defines an before hook.
57
+ *
58
+ * @param order the order in which this hook should run. Higher numbers are run first
59
+ */
47
60
def Before (order : Int ): HookBody = Before (EMPTY_TAG_EXPRESSION , order)
48
61
49
- def Before (tagExpression : String , order : Int ): HookBody = new HookBody (HookType .BEFORE , tagExpression, order)
50
-
62
+ /**
63
+ * Defines an before hook.
64
+ *
65
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
66
+ * @param order the order in which this hook should run. Higher numbers are run first
67
+ */
68
+ def Before (tagExpression : String , order : Int ) = new HookBody (HookType .BEFORE , tagExpression, order)
69
+
70
+ /**
71
+ * Defines an before step hook.
72
+ */
51
73
def BeforeStep : HookBody = BeforeStep (EMPTY_TAG_EXPRESSION , DEFAULT_BEFORE_ORDER )
52
74
75
+ /**
76
+ * Defines an before step hook.
77
+ *
78
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
79
+ */
53
80
def BeforeStep (tagExpression : String ): HookBody = BeforeStep (tagExpression, DEFAULT_BEFORE_ORDER )
54
81
82
+ /**
83
+ * Defines an before step hook.
84
+ *
85
+ * @param order the order in which this hook should run. Higher numbers are run first
86
+ */
55
87
def BeforeStep (order : Int ): HookBody = BeforeStep (EMPTY_TAG_EXPRESSION , order)
56
88
57
- def BeforeStep (tagExpression : String , order : Int ): HookBody = new HookBody (HookType .BEFORE_STEP , tagExpression, order)
58
-
89
+ /**
90
+ * Defines an before step hook.
91
+ *
92
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
93
+ * @param order the order in which this hook should run. Higher numbers are run first
94
+ */
95
+ def BeforeStep (tagExpression : String , order : Int ) = new HookBody (HookType .BEFORE_STEP , tagExpression, order)
96
+
97
+ /**
98
+ * Defines and after hook.
99
+ */
59
100
def After : HookBody = After (EMPTY_TAG_EXPRESSION , DEFAULT_AFTER_ORDER )
60
101
102
+ /**
103
+ * Defines and after hook.
104
+ *
105
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
106
+ */
61
107
def After (tagExpression : String ): HookBody = After (tagExpression, DEFAULT_AFTER_ORDER )
62
108
109
+ /**
110
+ * Defines and after hook.
111
+ *
112
+ * @param order the order in which this hook should run. Higher numbers are run first
113
+ */
63
114
def After (order : Int ): HookBody = After (EMPTY_TAG_EXPRESSION , order)
64
115
65
- def After (tagExpression : String , order : Int ): HookBody = new HookBody (HookType .AFTER , tagExpression, order)
66
-
116
+ /**
117
+ * Defines and after hook.
118
+ *
119
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
120
+ * @param order the order in which this hook should run. Higher numbers are run first
121
+ */
122
+ def After (tagExpression : String , order : Int ) = new HookBody (HookType .AFTER , tagExpression, order)
123
+
124
+ /**
125
+ * Defines and after step hook.
126
+ */
67
127
def AfterStep : HookBody = AfterStep (EMPTY_TAG_EXPRESSION , DEFAULT_AFTER_ORDER )
68
128
129
+ /**
130
+ * Defines and after step hook.
131
+ *
132
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
133
+ */
69
134
def AfterStep (tagExpression : String ): HookBody = AfterStep (tagExpression, DEFAULT_AFTER_ORDER )
70
135
136
+ /**
137
+ * Defines and after step hook.
138
+ *
139
+ * @param order the order in which this hook should run. Higher numbers are run first
140
+ */
71
141
def AfterStep (order : Int ): HookBody = AfterStep (EMPTY_TAG_EXPRESSION , order)
72
142
73
- def AfterStep (tagExpression : String , order : Int ): HookBody = new HookBody (HookType .AFTER_STEP , tagExpression, order)
143
+ /**
144
+ * Defines and after step hook.
145
+ *
146
+ * @param tagExpression a tag expression, if the expression applies to the current scenario this hook will be executed
147
+ * @param order the order in which this hook should run. Higher numbers are run first
148
+ */
149
+ def AfterStep (tagExpression : String , order : Int ) = new HookBody (HookType .AFTER_STEP , tagExpression, order)
74
150
75
151
final class HookBody (hookType : HookType , tagExpression : String , order : Int ) {
76
152
@@ -98,6 +174,14 @@ private[scala] trait HookDsl extends BaseScalaDsl {
98
174
99
175
private [scala] trait DocStringTypeDsl extends BaseScalaDsl {
100
176
177
+ /**
178
+ * Register doc string type.
179
+ *
180
+ * @param contentType Name of the content type.
181
+ * @param body a function that creates an instance of <code>T</code>
182
+ * from the doc string
183
+ * @tparam T type to convert to
184
+ */
101
185
def DocStringType [T ](contentType : String )(body : DocStringDefinitionBody [T ])(implicit ev : ClassTag [T ]): Unit = {
102
186
registry.docStringTypes += ScalaDocStringTypeDetails [T ](contentType, body, ev)
103
187
}
@@ -106,8 +190,20 @@ private[scala] trait DocStringTypeDsl extends BaseScalaDsl {
106
190
107
191
private [scala] trait DataTableTypeDsl extends BaseScalaDsl {
108
192
193
+ /**
194
+ * Register a data table type.
195
+ */
109
196
def DataTableType : DataTableTypeBody = DataTableType (NO_REPLACEMENT )
110
197
198
+ /**
199
+ * Register a data table type with a replacement.
200
+ * <p>
201
+ * A data table can only represent absent and non-empty strings. By replacing
202
+ * a known value (for example [empty]) a data table can also represent
203
+ * empty strings.
204
+ *
205
+ * @param replaceWithEmptyString a string that will be replaced with an empty string.
206
+ */
111
207
def DataTableType (replaceWithEmptyString : String ): DataTableTypeBody = DataTableType (Seq (replaceWithEmptyString))
112
208
113
209
private def DataTableType (replaceWithEmptyString : Seq [String ]) = new DataTableTypeBody (replaceWithEmptyString)
@@ -136,6 +232,13 @@ private[scala] trait DataTableTypeDsl extends BaseScalaDsl {
136
232
137
233
private [scala] trait ParameterTypeDsl extends BaseScalaDsl {
138
234
235
+ /**
236
+ * Register parameter type.
237
+ *
238
+ * @param name used as the type name in typed expressions
239
+ * @param regex expression to match
240
+ * @see https://cucumber.io/docs/cucumber/cucumber-expressions
241
+ */
139
242
def ParameterType (name : String , regex : String ) = new ParameterTypeBody (name, regex)
140
243
141
244
final class ParameterTypeBody (name : String , regex : String ) {
@@ -306,14 +409,35 @@ private[scala] trait ParameterTypeDsl extends BaseScalaDsl {
306
409
307
410
private [scala] trait DefaultTransformerDsl extends BaseScalaDsl {
308
411
412
+ /**
413
+ * Register default parameter type transformer.
414
+ *
415
+ * @param body converts `String` argument to an instance of the `Type` argument
416
+ */
309
417
def DefaultParameterTransformer (body : DefaultParameterTransformerBody ): Unit = {
310
418
registry.defaultParameterTransformers += ScalaDefaultParameterTransformerDetails (body)
311
419
}
312
420
421
+ /**
422
+ * Register default data table cell transformer.
423
+ *
424
+ * @param body converts `String` argument to an instance of the `Type` argument
425
+ */
313
426
def DefaultDataTableCellTransformer (body : DefaultDataTableCellTransformerBody ): Unit = {
314
427
DefaultDataTableCellTransformer (NO_REPLACEMENT )(body)
315
428
}
316
429
430
+ /**
431
+ * Register default data table cell transformer with a replacement.
432
+ * <p>
433
+ * A data table can only represent absent and non-empty strings. By replacing
434
+ * a known value (for example [empty]) a data table can also represent
435
+ * empty strings.
436
+ * *
437
+ *
438
+ * @param replaceWithEmptyString a string that will be replaced with an empty string.
439
+ * @param body converts `String` argument to an instance of the `Type` argument
440
+ */
317
441
def DefaultDataTableCellTransformer (replaceWithEmptyString : String )(body : DefaultDataTableCellTransformerBody ): Unit = {
318
442
DefaultDataTableCellTransformer (Seq (replaceWithEmptyString))(body)
319
443
}
@@ -322,10 +446,25 @@ private[scala] trait DefaultTransformerDsl extends BaseScalaDsl {
322
446
registry.defaultDataTableCellTransformers += ScalaDefaultDataTableCellTransformerDetails (replaceWithEmptyString, body)
323
447
}
324
448
449
+ /**
450
+ * Register default data table entry transformer.
451
+ *
452
+ * @param body converts `Map[String,String]` argument to an instance of the `Type` argument
453
+ */
325
454
def DefaultDataTableEntryTransformer (body : DefaultDataTableEntryTransformerBody ): Unit = {
326
455
DefaultDataTableEntryTransformer (NO_REPLACEMENT )(body)
327
456
}
328
457
458
+ /**
459
+ * Register default data table cell transformer with a replacement.
460
+ * <p>
461
+ * A data table can only represent absent and non-empty strings. By replacing
462
+ * a known value (for example [empty]) a data table can also represent
463
+ * empty strings.
464
+ *
465
+ * @param replaceWithEmptyString a string that will be replaced with an empty string.
466
+ * @param body converts `Map[String,String]` argument to an instance of the `Type` argument
467
+ */
329
468
def DefaultDataTableEntryTransformer (replaceWithEmptyString : String )(body : DefaultDataTableEntryTransformerBody ): Unit = {
330
469
DefaultDataTableEntryTransformer (Seq (replaceWithEmptyString))(body)
331
470
}
0 commit comments