Skip to content

Commit ec9d79f

Browse files
author
Pedro González Marcos
committed
feat: add test description to negative tests csv file
1 parent b2562e1 commit ec9d79f

2 files changed

Lines changed: 81 additions & 82 deletions

File tree

src/test/java/io/github/isagroup/parsing/PricingManagerParserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ void givenVersionV11ShouldParse() {
9595
}
9696
}
9797

98-
@ParameterizedTest
98+
@ParameterizedTest(name = "{0} - {1}")
9999
@CsvFileSource(resources = "/negative-parsing-tests.csv", delimiter = ';')
100-
void negativeTests(String fileName, String expectedErrorMessage) {
100+
void negativeTests(String testDescription, String fileName, String expectedErrorMessage) {
101101

102102
try {
103103
YamlUtils.retrieveManagerFromYaml(fileName);
Lines changed: 79 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,81 @@
1-
# This file is autogenerated by MergeCSV.java script
2-
# FILENAME;EXPECTED_ERROR_MESSAGE
3-
# dependsOn.csv
4-
parsing/negative/addOn/dependsOn/unexistent-addOn.yml;The addOn bax is not defined in the pricing manager
5-
# private.csv
6-
parsing/negative/addOn/private/boolean-string-private.yml;The field "private" should be a boolean
7-
parsing/negative/addOn/private/number-private.yml;The field "private" should be a boolean
8-
parsing/negative/addOn/private/string-private.yml;The field "private" should be a boolean
9-
# usageLimits.csv
10-
parsing/negative/addOn/usageLimits/usageLimits-not-a-map.yml;The usage limit fooLimit of the add-on Baz is not a valid map. Maybe 'value' attribute is missing to set the value of the limit
11-
# usageLimitsExtensions.csv
12-
parsing/negative/addOn/usageLimitsExtensions/usageLimitsExtensions-not-a-map.yml;The usage limit fooLimit of the add-on Baz is not a valid map. Maybe 'value' attribute is missing to set the value of the limit
13-
# billing.csv
14-
parsing/negative/billing/boolean-as-billing-value.yml;The value for billing key 'monthly' must be a Double or an Integer, but found Boolean
15-
parsing/negative/billing/boolean-in-a-single-entry.yml;The value for billing key 'annual' must be a Double or an Integer, but found Boolean
16-
parsing/negative/billing/negative-coef-big.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found -1000.0
17-
parsing/negative/billing/negative-coef-low.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found -0.1
18-
parsing/negative/billing/null-as-billing-value.yml;The billing key 'monthly' cannot have a null value
19-
parsing/negative/billing/null-in-a-single-entry.yml;The billing key 'annual' cannot have a null value
20-
parsing/negative/billing/outbound-upper-coef-big.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found 1000.0
21-
parsing/negative/billing/outbound-upper-coef-close.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found 1.1
22-
parsing/negative/billing/zero-coef.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found 0.0
23-
# createdAt.csv
24-
parsing/negative/createdAt/pricing-invalid-format-createdAt.yml;"createdAt" "test" is invalid, use the following yyyy-MM-dd
25-
parsing/negative/createdAt/pricing-invalid-type-createdAt.yml;"createdAt" detected type is Integer and must be a String or Date formatted like yyyy-MM-dd
26-
parsing/negative/createdAt/pricing-no-createdAt.yml;'createdAt' is mandatory. Check your config file.
27-
parsing/negative/createdAt/pricing-null-createdAt.yml;'createdAt' is mandatory. Check your config file.
28-
# currency.csv
29-
parsing/negative/currency/currency-is-boolean.yml;'currency' has to be a string
30-
parsing/negative/currency/currency-is-null.yml;Currency was not defined
31-
# feature.csv
32-
parsing/negative/feature/feature-is-key-value.yml;Feature 'foo' must be a Map but found String instead
33-
parsing/negative/feature/feature-null-as-key.yml;A feature cannot have the name null
34-
# type.csv
35-
parsing/negative/feature/type/null-type.yml;feature 'type' is mandatory
36-
# valueType.csv
37-
parsing/negative/feature/valueType/null-valueType.yml;Feature value type is null
38-
parsing/negative/feature/valueType/unsupported-valueType.yml;The feature foo does not have a supported valueType. Current valueType: foo
39-
# features.csv
40-
parsing/negative/features/features-is-boolean.yml;'features' must be a Map but found Boolean instead
41-
parsing/negative/features/features-is-float.yml;'features' must be a Map but found Double instead
42-
parsing/negative/features/features-is-integer.yml;'features' must be a Map but found Integer instead
43-
parsing/negative/features/features-is-list.yml;'features' must be a Map but found ArrayList instead
44-
parsing/negative/features/features-is-null.yml;'features' is mandatory. It should be a map of features with their correspoding attributes.
45-
parsing/negative/features/features-is-string.yml;'features' must be a Map but found String instead
46-
# price.csv
1+
# TEST_DESCRIPTION;FILENAME;EXPECTED_ERROR_MESSAGE
2+
# addOn.dependsOn
3+
Throw an error when refering to an add-on that does not exist in 'dependsOn';parsing/negative/addOn/dependsOn/unexistent-addOn.yml;The addOn bax is not defined in the pricing manager
4+
# addOn.private
5+
Throw an error if add-on 'private' field is not a boolean;parsing/negative/addOn/private/boolean-string-private.yml;The field "private" should be a boolean
6+
Throw an error if add-on 'private' field is not a boolean;parsing/negative/addOn/private/number-private.yml;The field "private" should be a boolean
7+
Throw an error if add-on 'private' field is not a boolean;parsing/negative/addOn/private/string-private.yml;The field "private" should be a boolean
8+
# addOn.usageLimits
9+
Throw an error if add-on 'usageLimits' is not a map;parsing/negative/addOn/usageLimits/usageLimits-not-a-map.yml;The usage limit fooLimit of the add-on Baz is not a valid map. Maybe 'value' attribute is missing to set the value of the limit
10+
# addOn.usageLimitsExtensions
11+
Throw an error if add-on 'usageLimitExtensions' is not a map;parsing/negative/addOn/usageLimitsExtensions/usageLimitsExtensions-not-a-map.yml;The usage limit fooLimit of the add-on Baz is not a valid map. Maybe 'value' attribute is missing to set the value of the limit
12+
# billing
13+
Throw an error if billing is not a number;parsing/negative/billing/boolean-as-billing-value.yml;The value for billing key 'monthly' must be a Double or an Integer, but found Boolean
14+
Throw an error if billing is not a number;parsing/negative/billing/boolean-in-a-single-entry.yml;The value for billing key 'annual' must be a Double or an Integer, but found Boolean
15+
Throw an error if billing factor is negative;parsing/negative/billing/negative-coef-big.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found -1000.0
16+
Throw an error if billing factor is negative;parsing/negative/billing/negative-coef-low.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found -0.1
17+
Throw an error if billing factor is null;parsing/negative/billing/null-as-billing-value.yml;The billing key 'monthly' cannot have a null value
18+
Throw an error if billing factor is null;parsing/negative/billing/null-in-a-single-entry.yml;The billing key 'annual' cannot have a null value
19+
Throw an error if billing factor is larger than 1;parsing/negative/billing/outbound-upper-coef-big.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found 1000.0
20+
Throw an error if billing factor is larger than 1;parsing/negative/billing/outbound-upper-coef-close.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found 1.1
21+
Throw an error if billing factor is 0;parsing/negative/billing/zero-coef.yml;The value for billing key 'monthly' must be a coeficient in the range (0,1], but found 0.0
22+
# createdAt
23+
Throw an error if 'createdAt' date string is bad formated;parsing/negative/createdAt/pricing-invalid-format-createdAt.yml;"createdAt" "test" is invalid, use the following yyyy-MM-dd
24+
Throw an error if 'createdAt' is not a string or date;parsing/negative/createdAt/pricing-invalid-type-createdAt.yml;"createdAt" detected type is Integer and must be a String or Date formatted like yyyy-MM-dd
25+
Throw an error if 'createdAt' is missing;parsing/negative/createdAt/pricing-no-createdAt.yml;'createdAt' is mandatory. Check your config file.
26+
Throw an error if 'createdAt' is null;parsing/negative/createdAt/pricing-null-createdAt.yml;'createdAt' is mandatory. Check your config file.
27+
# currency
28+
Throw an error if 'currency' is not a string;parsing/negative/currency/currency-is-boolean.yml;'currency' has to be a string
29+
Throw an error if 'currency' is missing;parsing/negative/currency/currency-is-null.yml;Currency was not defined
30+
# feature
31+
Throw an error if a feature is not a map of attributes;parsing/negative/feature/feature-is-key-value.yml;Feature 'foo' must be a Map but found String instead
32+
Throw an error if a feature is named 'null';parsing/negative/feature/feature-null-as-key.yml;A feature cannot have the name null
33+
# feature.type
34+
Throw an error if feature 'type' is missing or null;parsing/negative/feature/type/null-type.yml;feature 'type' is mandatory
35+
# feature.valueType
36+
Throw an error if feature 'type' is missing or null;parsing/negative/feature/valueType/null-valueType.yml;Feature value type is null
37+
Throw an error if feature 'type' is not a supported feature type;parsing/negative/feature/valueType/unsupported-valueType.yml;The feature foo does not have a supported valueType. Current valueType: foo
38+
# features
39+
Throw an error if 'features' is not a map;parsing/negative/features/features-is-boolean.yml;'features' must be a Map but found Boolean instead
40+
Throw an error if 'features' is not a map;parsing/negative/features/features-is-float.yml;'features' must be a Map but found Double instead
41+
Throw an error if 'features' is not a map;parsing/negative/features/features-is-integer.yml;'features' must be a Map but found Integer instead
42+
Throw an error if 'features' is not a map;parsing/negative/features/features-is-list.yml;'features' must be a Map but found ArrayList instead
43+
Throw an error if 'features' is missing or null;parsing/negative/features/features-is-null.yml;'features' is mandatory. It should be a map of features with their correspoding attributes.
44+
Throw an error if 'features' is not a map;parsing/negative/features/features-is-string.yml;'features' must be a Map but found String instead
45+
# plan.price
4746
#parsing/negative/plan/price/price-expression-no-variables.yml;The operator 'MULTIPLY' is not supported between objects of type 'java.lang.Integer' and 'null'
4847
#parsing/negative/plan/price/price-expression-string-variables.yml;The operator 'MULTIPLY' is not supported between objects of type 'java.lang.Integer' and 'java.lang.String'
49-
# private.csv
50-
parsing/negative/plan/private/boolean-string-private.yml;The field "private" should be a boolean
51-
parsing/negative/plan/private/number-private.yml;The field "private" should be a boolean
52-
parsing/negative/plan/private/string-private.yml;The field "private" should be a boolean
53-
# plans.csv
54-
parsing/negative/plans/plans-is-boolean.yml;The plans are not defined correctly. It should be a map of plans and their options
55-
parsing/negative/plans/plans-is-float.yml;The plans are not defined correctly. It should be a map of plans and their options
56-
parsing/negative/plans/plans-is-integer.yml;The plans are not defined correctly. It should be a map of plans and their options
57-
parsing/negative/plans/plans-is-list.yml;The plans are not defined correctly. It should be a map of plans and their options
58-
parsing/negative/plans/plans-is-string.yml;The plans are not defined correctly. It should be a map of plans and their options
59-
# root.csv
60-
parsing/negative/null-plans-and-addons.yml;The pricing manager does not have any plans or add ons
61-
# saasName.csv
62-
parsing/negative/saasName/pricing-empty-name.yml;The 'saasName' field must be a String with a length between 3 and 50 characters
63-
parsing/negative/saasName/pricing-invalid-name.yml;'saasName' has to be a string
64-
parsing/negative/saasName/pricing-long-name.yml;The 'saasName' field must be a String with a length between 3 and 50 characters
65-
parsing/negative/saasName/pricing-no-name.yml;SaasName was not defined
66-
parsing/negative/saasName/pricing-null-name.yml;SaasName was not defined
67-
parsing/negative/saasName/pricing-short-name.yml;The 'saasName' field must be a String with a length between 3 and 50 characters
68-
# tags.csv
69-
parsing/negative/tags/invalid-tags.yml;"tags" type is String and must be a List
70-
parsing/negative/tags/pricing-tag-not-in-tags.yml;The tag Tag 3 is not defined in the global tags.
71-
# url.csv
72-
parsing/negative/url/boolean-url.yml;If 'url' field is used, it has to be a string
73-
parsing/negative/url/invalid-protocol-url.yml;The 'url' field must be a String with a valid URL format, using http or https protocol
74-
parsing/negative/url/invalid-string-url.yml;The 'url' field must be a String with a valid URL format, using http or https protocol
75-
parsing/negative/url/number-url.yml;If 'url' field is used, it has to be a string
76-
# variables.csv
77-
parsing/negative/variables/variables-is-boolean.yml;variables must be a map but found Boolean instead
78-
# version.csv
79-
parsing/negative/version/pricing-invalid-format-version.yml;Invalid version "1.0.0", use <major>.<minor> version format
80-
parsing/negative/version/pricing-invalid-type-version.yml;Cannot parse 100 to a version
81-
parsing/negative/version/pricing-no-version.yml;The version field of the pricing must not be null or undefined. Please ensure that the version field is present and correctly formatted
82-
parsing/negative/version/pricing-null-version.yml;The version field of the pricing must not be null or undefined. Please ensure that the version field is present and correctly formatted
48+
# plan.private
49+
Throw an error if plan 'private' is not a boolean;parsing/negative/plan/private/boolean-string-private.yml;The field "private" should be a boolean
50+
Throw an error if plan 'private' is not a boolean;parsing/negative/plan/private/number-private.yml;The field "private" should be a boolean
51+
Throw an error if plan 'private' is not a boolean;parsing/negative/plan/private/string-private.yml;The field "private" should be a boolean
52+
# plans
53+
Throw an error if 'plans' is not a map;parsing/negative/plans/plans-is-boolean.yml;The plans are not defined correctly. It should be a map of plans and their options
54+
Throw an error if 'plans' is not a map;parsing/negative/plans/plans-is-float.yml;The plans are not defined correctly. It should be a map of plans and their options
55+
Throw an error if 'plans' is not a map;parsing/negative/plans/plans-is-integer.yml;The plans are not defined correctly. It should be a map of plans and their options
56+
Throw an error if 'plans' is not a map;parsing/negative/plans/plans-is-list.yml;The plans are not defined correctly. It should be a map of plans and their options
57+
Throw an error if 'plans' is not a map;parsing/negative/plans/plans-is-string.yml;The plans are not defined correctly. It should be a map of plans and their options
58+
# saasName
59+
Throw an error if 'saasName' is empty;parsing/negative/saasName/pricing-empty-name.yml;The 'saasName' field must be a String with a length between 3 and 50 characters
60+
Throw an error if 'saasName' is not a string;parsing/negative/saasName/pricing-invalid-name.yml;'saasName' has to be a string
61+
Throw an error if 'saasName' is too long;parsing/negative/saasName/pricing-long-name.yml;The 'saasName' field must be a String with a length between 3 and 50 characters
62+
Throw an error if 'saasName' is missing;parsing/negative/saasName/pricing-no-name.yml;SaasName was not defined
63+
Throw an error if 'saasName' is null;parsing/negative/saasName/pricing-null-name.yml;SaasName was not defined
64+
Throw an error if 'saasName' is too short;parsing/negative/saasName/pricing-short-name.yml;The 'saasName' field must be a String with a length between 3 and 50 characters
65+
# tags
66+
Throw an error if 'tags' is not a list;parsing/negative/tags/invalid-tags.yml;"tags" type is String and must be a List
67+
Throw an eror if a feature 'tag' is refering to a non existent tag in 'tags';parsing/negative/tags/pricing-tag-not-in-tags.yml;The tag Tag 3 is not defined in the global tags.
68+
# url
69+
Throw an error if 'url' is not a string;parsing/negative/url/boolean-url.yml;If 'url' field is used, it has to be a string
70+
Throw an error if 'url' protocol is not http or https;parsing/negative/url/invalid-protocol-url.yml;The 'url' field must be a String with a valid URL format, using http or https protocol
71+
Throw an error if 'url' is a plain string;parsing/negative/url/invalid-string-url.yml;The 'url' field must be a String with a valid URL format, using http or https protocol
72+
Throw an error if 'url' is not a string;parsing/negative/url/number-url.yml;If 'url' field is used, it has to be a string
73+
# variables
74+
Throw an error if 'variables' is not a map;parsing/negative/variables/variables-is-boolean.yml;variables must be a map but found Boolean instead
75+
# version
76+
Throw an error if 'version' is bad formated;parsing/negative/version/pricing-invalid-format-version.yml;Invalid version "1.0.0", use <major>.<minor> version format
77+
Throw an error if 'version' is not a string like <major>.<minor>;parsing/negative/version/pricing-invalid-type-version.yml;Cannot parse 100 to a version
78+
Throw an error if 'version' is missing;parsing/negative/version/pricing-no-version.yml;The version field of the pricing must not be null or undefined. Please ensure that the version field is present and correctly formatted
79+
Throw an error if 'version' is null;parsing/negative/version/pricing-null-version.yml;The version field of the pricing must not be null or undefined. Please ensure that the version field is present and correctly formatted
80+
# other checks
81+
Throw an error if 'plans' and 'addOns' are null at the same time;parsing/negative/null-plans-and-addons.yml;The pricing manager does not have any plans or add ons

0 commit comments

Comments
 (0)