@@ -65,18 +65,31 @@ Feature: V3 era Matching Rules
6565 When the requests are compared to the expected one
6666 Then the comparison should be OK
6767
68+ Scenario : Supports a number type matcher where it is acceptable to coerce values from string form
69+ Given an expected request configured with the following:
70+ | query | headers | matching rules |
71+ | a =1234 | 'X -A : 1234 ' | number -type -matcher -v3 .json |
72+ And the following requests are received:
73+ | query | headers | desc |
74+ | a =100 | 'X -A : 100 ' | Integer number |
75+ | a =100 .2 | 'X -A : 100 .4 ' | Floating point number |
76+ When the requests are compared to the expected one
77+ Then the comparison should be OK
78+
6879 Scenario : Supports a number type matcher (negative case)
6980 Given an expected request configured with the following:
7081 | body | matching rules |
7182 | file : basic .json | number -type -matcher -v3 .json |
7283 And the following requests are received:
73- | body | desc |
74- | JSON : { "one ": true , "two ": "b " } | Boolean |
75- | JSON : { "one ": "100X01 ", "two ": "b " } | String |
84+ | body | desc |
85+ | JSON : { "one ": true , "two ": "b " } | Boolean |
86+ | JSON : { "one ": "100X01 ", "two ": "b " } | String |
87+ | JSON : { "one ": "100 ", "two ": "b " } | Number in string form is not acceptable in bodies |
7688 When the requests are compared to the expected one
7789 Then the comparison should NOT be OK
7890 And the mismatches will contain a mismatch with error "$.one" -> "Expected true (Boolean) to be a number"
7991 And the mismatches will contain a mismatch with error "$.one" -> "Expected '100X01' (String) to be a number"
92+ And the mismatches will contain a mismatch with error "$.one" -> "Expected '100' (String) to be a number"
8093
8194 Scenario : Supports an integer type matcher, no digits after the decimal point (positive case)
8295 Given an expected request configured with the following:
@@ -85,7 +98,16 @@ Feature: V3 era Matching Rules
8598 And the following requests are received:
8699 | body | desc |
87100 | JSON : { "one ": 100 , "two ": "b " } | Integer number |
88- | JSON : { "one ": "100 ", "two ": "b " } | String representation of an integer |
101+ When the requests are compared to the expected one
102+ Then the comparison should be OK
103+
104+ Scenario : Supports an integer type matcher where it is acceptable to coerce values from string form
105+ Given an expected request configured with the following:
106+ | query | headers | matching rules |
107+ | a =1234 | 'X -A : 1234 ' | number -type -matcher -v3 .json |
108+ And the following requests are received:
109+ | query | headers | desc |
110+ | a =100 | 'X -A : 100 ' | Integer number |
89111 When the requests are compared to the expected one
90112 Then the comparison should be OK
91113
@@ -94,15 +116,17 @@ Feature: V3 era Matching Rules
94116 | body | matching rules |
95117 | file : basic .json | integer -type -matcher -v3 .json |
96118 And the following requests are received:
97- | body | desc |
98- | JSON : { "one ": [], "two ": "b " } | Array |
99- | JSON : { "one ": 100 .1 , "two ": "b " } | Floating point number |
100- | JSON : { "one ": "100X01 ", "two ": "b " } | Not a string representation of an integer |
119+ | body | desc |
120+ | JSON : { "one ": [], "two ": "b " } | Array |
121+ | JSON : { "one ": 100 .1 , "two ": "b " } | Floating point number |
122+ | JSON : { "one ": "100X01 ", "two ": "b " } | String |
123+ | JSON : { "one ": "100 ", "two ": "b " } | String representation of an integer is not acceptable in bodies |
101124 When the requests are compared to the expected one
102125 Then the comparison should NOT be OK
103126 And the mismatches will contain a mismatch with error "$.one" -> "Expected [] (Array) to be an integer"
104127 And the mismatches will contain a mismatch with error "$.one" -> "Expected 100.1 (Decimal) to be an integer"
105128 And the mismatches will contain a mismatch with error "$.one" -> "Expected '100X01' (String) to be an integer"
129+ And the mismatches will contain a mismatch with error "$.one" -> "Expected '100' (String) to be an integer"
106130
107131 Scenario : Supports an decimal type matcher, must have significant digits after the decimal point (positive case)
108132 Given an expected request configured with the following:
@@ -111,7 +135,6 @@ Feature: V3 era Matching Rules
111135 And the following requests are received:
112136 | body | desc |
113137 | JSON : { "one ": 100 .1234 , "two ": "b " } | Floating point number |
114- | JSON : { "one ": "100 .1234 ", "two ": "b " } | String representation of a floating point number |
115138 When the requests are compared to the expected one
116139 Then the comparison should be OK
117140
@@ -120,15 +143,27 @@ Feature: V3 era Matching Rules
120143 | body | matching rules |
121144 | file : basic .json | decimal -type -matcher -v3 .json |
122145 And the following requests are received:
123- | body | desc |
124- | JSON : { "one ": null , "two ": "b " } | Null |
125- | JSON : { "one ": 100 , "two ": "b " } | Integer number |
126- | JSON : { "one ": "100X01 ", "two ": "b " } | Not a string representation of an decimal number |
146+ | body | desc |
147+ | JSON : { "one ": null , "two ": "b " } | Null |
148+ | JSON : { "one ": 100 , "two ": "b " } | Integer number |
149+ | JSON : { "one ": "100X01 ", "two ": "b " } | String value |
150+ | JSON : { "one ": "100 .1234 ", "two ": "b " } | String representation of a floating point number is not acceptable in bodies |
127151 When the requests are compared to the expected one
128152 Then the comparison should NOT be OK
129153 And the mismatches will contain a mismatch with error "$.one" -> "Expected null (Null) to be a decimal number"
130154 And the mismatches will contain a mismatch with error "$.one" -> "Expected 100 (Integer) to be a decimal number"
131155 And the mismatches will contain a mismatch with error "$.one" -> "Expected '100X01' (String) to be a decimal number"
156+ And the mismatches will contain a mismatch with error "$.one" -> "Expected '100.1234' (String) to be a decimal number"
157+
158+ Scenario : Supports a decimal type matcher where it is acceptable to coerce values from string form
159+ Given an expected request configured with the following:
160+ | query | headers | matching rules |
161+ | a =1234 .0 | 'X -A : 1234 .0 ' | number -type -matcher -v3 .json |
162+ And the following requests are received:
163+ | query | headers | desc |
164+ | a =100 .2 | 'X -A : 100 .4 ' | Floating point number |
165+ When the requests are compared to the expected one
166+ Then the comparison should be OK
132167
133168 Scenario : Supports a null matcher (positive case)
134169 Given an expected request configured with the following:
0 commit comments