Skip to content

Commit 0056eab

Browse files
committed
Fix issues with default values for boolean arguments and their negatable values
1 parent 6c9dc16 commit 0056eab

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/main/java/com/endava/cats/args/ProcessingArguments.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class ProcessingArguments {
3232
description = "This can be either sanitizeAndValidation or validateAndSanitize. It can be used to specify what CATS should expect when sending Unicode Control Chars and Other Symbols within the fields. Default: @|bold,underline ${DEFAULT-VALUE}|@")
3333
private SanitizationStrategy sanitizationStrategy = SanitizationStrategy.SANITIZE_AND_VALIDATE;
3434

35-
@CommandLine.Option(names = {"--useExamples"}, negatable = true,
35+
@CommandLine.Option(names = {"--useExamples"}, negatable = true, defaultValue = "true", fallbackValue = "true",
3636
description = "Use examples from the OpenAPI contract or not. Default: @|bold,underline ${DEFAULT-VALUE}|@")
3737
private boolean useExamples = true;
3838

@@ -60,30 +60,30 @@ public class ProcessingArguments {
6060
Map<String, String> xxxOfSelections;
6161

6262
@Setter
63-
@CommandLine.Option(names = {"--rfc7396"}, negatable = true,
63+
@CommandLine.Option(names = {"--rfc7396"},
6464
description = "When set to @|bold true|@ it will send Content-Type=application/merge-patch+json for PATCH requests. Default: @|bold,underline ${DEFAULT-VALUE}|@")
65-
private boolean rfc7396 = false;
65+
private boolean rfc7396;
6666

6767
@Setter
68-
@CommandLine.Option(names = {"--allowInvalidEnumValues"}, negatable = true,
69-
description = "When set to @|bold true|@ the InvalidValuesInEnumsFieldsFuzzer will be disabled. Default: @|bold,underline ${DEFAULT-VALUE}|@")
70-
private boolean allowInvalidEnumValues = false;
68+
@CommandLine.Option(names = {"--allowInvalidEnumValues"},
69+
description = "When set to @|bold true|@ the InvalidValuesInEnumsFieldsFuzzer will expect a 2XX response code instead of 4XX. Default: @|bold,underline ${DEFAULT-VALUE}|@")
70+
private boolean allowInvalidEnumValues;
7171

7272
@CommandLine.Option(names = {"--limitXxxOfCombinations"},
7373
description = "Max number of anyOf/oneOf combinations. Default: @|bold,underline ${DEFAULT-VALUE}|@")
7474
private int limitXxxOfCombinations = 20;
7575

76-
@CommandLine.Option(names = {"--generateXxxCombinationsForResponses"}, negatable = true,
76+
@CommandLine.Option(names = {"--generateXxxCombinationsForResponses"},
7777
description = "Generate anyOf/oneOf combinations also for response schemas. By default it creates one response payload with all possibilities. Default: @|bold,underline ${DEFAULT-VALUE}|@")
78-
private boolean generateAllXxxCombinationsForResponses = false;
78+
private boolean generateAllXxxCombinationsForResponses;
7979

80-
@CommandLine.Option(names = {"--filterXxxFromRequestPayloads"}, negatable = true,
80+
@CommandLine.Option(names = {"--filterXxxFromRequestPayloads"}, negatable = true, defaultValue = "true", fallbackValue = "true",
8181
description = "In extremely rare cases when CATS fails to generate anyOf/oneOf combinations some requests may still contain ONE_OF/ANY_OF markers. They are filtered out by default. " +
8282
"Setting this to false will send them as requests which will probably fail. It's mostly for debug purposes. Default: @|bold,underline ${DEFAULT-VALUE}|@")
8383
private boolean filterXxxFromRequestPayloads = true;
8484

85-
@CommandLine.Option(names = {"--useDefaults"}, negatable = true,
86-
description = "If set to true, it will use the default values when generating examples. Default: @|bold,underline ${DEFAULT-VALUE}|@", arity = "1")
85+
@CommandLine.Option(names = {"--useDefaults"}, negatable = true, defaultValue = "true", fallbackValue = "true",
86+
description = "If set to true, it will use the default values when generating examples. Default: @|bold,underline ${DEFAULT-VALUE}|@")
8787
private boolean useDefaults = true;
8888

8989
/**

src/main/java/com/endava/cats/args/ReportingArguments.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public class ReportingArguments {
6262
description = "Make selected commands output to console in JSON format.")
6363
private boolean jsonOutput;
6464

65-
@CommandLine.Option(names = {"--checkUpdate"}, negatable = true,
65+
@CommandLine.Option(names = {"--checkUpdate"}, negatable = true, defaultValue = "true", fallbackValue = "true",
6666
description = "If true checks if there is a CATS update available and prints the release notes along with the links. Default: @|bold,underline ${DEFAULT-VALUE}|@")
6767
private boolean checkUpdate = true;
6868

69-
@CommandLine.Option(names = {"--color"}, negatable = true,
69+
@CommandLine.Option(names = {"--color"}, negatable = true, defaultValue = "true", fallbackValue = "true",
7070
description = "If true enables coloured console output. Default: @|bold,underline ${DEFAULT-VALUE}|@")
7171
private boolean color = true;
7272

src/main/java/com/endava/cats/args/UserArguments.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class UserArguments {
2626

2727
@CommandLine.Option(names = {"--simpleReplace"},
2828
description = "If set to true, it will simply do a replace between the targetFields names provided and the fuzz values")
29-
boolean simpleReplace = false;
29+
boolean simpleReplace;
3030

3131
/**
3232
* Gets the custom provided dictionary as a list of strings where each row is an item.

0 commit comments

Comments
 (0)