From 4a2e033a44da01fa635c9b8606f8c39b5122a419 Mon Sep 17 00:00:00 2001 From: Madalin Ilie Date: Wed, 11 May 2022 22:32:10 +0300 Subject: [PATCH] Change numeric fields to be used as Numbers instead of Strings --- .../fuzzer/fields/BooleanFieldsFuzzer.java | 2 +- .../DecimalFieldsLeftBoundaryFuzzer.java | 4 +- .../DecimalFieldsRightBoundaryFuzzer.java | 4 +- .../DecimalValuesInIntegerFieldsFuzzer.java | 4 +- ...tremeNegativeValueDecimalFieldsFuzzer.java | 4 +- ...tremeNegativeValueIntegerFieldsFuzzer.java | 4 +- ...tremePositiveValueDecimalFieldsFuzzer.java | 4 +- ...emePositiveValueInIntegerFieldsFuzzer.java | 4 +- .../IntegerFieldsLeftBoundaryFuzzer.java | 4 +- .../IntegerFieldsRightBoundaryFuzzer.java | 4 +- .../InvalidValuesInEnumsFieldsFuzzer.java | 2 +- ...LengthExactValuesInStringFieldsFuzzer.java | 2 +- ...ximumExactValuesInNumericFieldsFuzzer.java | 2 +- ...LengthExactValuesInStringFieldsFuzzer.java | 2 +- ...nimumExactValuesInNumericFieldsFuzzer.java | 2 +- .../fuzzer/fields/RemoveFieldsFuzzer.java | 2 +- .../StringFieldsLeftBoundaryFuzzer.java | 2 +- .../StringFieldsRightBoundaryFuzzer.java | 2 +- .../StringFormatAlmostValidValuesFuzzer.java | 2 +- .../StringFormatTotallyWrongValuesFuzzer.java | 2 +- .../fields/StringsInNumericFieldsFuzzer.java | 2 +- .../VeryLargeUnicodeValuesInFieldsFuzzer.java | 4 +- .../fields/VeryLargeValuesInFieldsFuzzer.java | 2 +- .../fields/base/BaseBoundaryFieldFuzzer.java | 2 +- .../fuzzer/fields/base/BaseFieldsFuzzer.java | 4 +- ...ontrolCharsInFieldsTrimValidateFuzzer.java | 4 +- ...ontrolCharsInFieldsValidateTrimFuzzer.java | 2 +- ...PointEmojisInFieldsTrimValidateFuzzer.java | 4 +- ...PointEmojisInFieldsValidateTrimFuzzer.java | 2 +- ...PointEmojisInFieldsTrimValidateFuzzer.java | 4 +- ...PointEmojisInFieldsValidateTrimFuzzer.java | 2 +- ...WhitespacesInFieldsTrimValidateFuzzer.java | 4 +- ...WhitespacesInFieldsValidateTrimFuzzer.java | 2 +- .../InvisibleCharsOnlyTrimValidateFuzzer.java | 4 +- ...ontrolCharsInFieldsTrimValidateFuzzer.java | 6 +- ...ontrolCharsInFieldsValidateTrimFuzzer.java | 6 +- ...PointEmojisInFieldsTrimValidateFuzzer.java | 6 +- ...PointEmojisInFieldsValidateTrimFuzzer.java | 6 +- ...PointEmojisInFieldsTrimValidateFuzzer.java | 6 +- ...PointEmojisInFieldsValidateTrimFuzzer.java | 6 +- ...WhitespacesInFieldsTrimValidateFuzzer.java | 6 +- ...WhitespacesInFieldsValidateTrimFuzzer.java | 6 +- ...ontrolCharsInFieldsTrimValidateFuzzer.java | 4 +- ...ontrolCharsInFieldsValidateTrimFuzzer.java | 2 +- ...PointEmojisInFieldsTrimValidateFuzzer.java | 4 +- ...PointEmojisInFieldsValidateTrimFuzzer.java | 2 +- ...PointEmojisInFieldsTrimValidateFuzzer.java | 4 +- ...PointEmojisInFieldsValidateTrimFuzzer.java | 2 +- ...WhitespacesInFieldsTrimValidateFuzzer.java | 4 +- ...WhitespacesInFieldsValidateTrimFuzzer.java | 2 +- ...olCharsInFieldsSanitizeValidateFuzzer.java | 4 +- ...olCharsInFieldsValidateSanitizeFuzzer.java | 4 +- ...PointEmojisInFieldsTrimValidateFuzzer.java | 4 +- ...PointEmojisInFieldsValidateTrimFuzzer.java | 4 +- ...VeryLargeUnicodeValuesInHeadersFuzzer.java | 4 +- .../VeryLargeValuesInHeadersFuzzer.java | 2 +- .../headers/base/BaseHeadersFuzzer.java | 2 +- .../base/BaseSecurityChecksHeadersFuzzer.java | 2 +- .../LeadingControlCharsInHeadersFuzzer.java | 2 +- ...ngMultiCodePointEmojisInHeadersFuzzer.java | 2 +- ...gSingleCodePointEmojisInHeadersFuzzer.java | 2 +- .../leading/LeadingSpacesInHeadersFuzzer.java | 2 +- .../LeadingWhitespacesInHeadersFuzzer.java | 2 +- .../only/OnlyControlCharsInHeadersFuzzer.java | 2 +- ...lyMultiCodePointEmojisInHeadersFuzzer.java | 2 +- ...ySingleCodePointEmojisInHeadersFuzzer.java | 2 +- .../only/OnlySpacesInHeadersFuzzer.java | 2 +- .../only/OnlyWhitespacesInHeadersFuzzer.java | 2 +- .../TrailingControlCharsInHeadersFuzzer.java | 2 +- ...lingMultiCodePointEmojisHeadersFuzzer.java | 2 +- ...ingSingleCodePointEmojisHeadersFuzzer.java | 2 +- .../TrailingSpacesInHeadersFuzzer.java | 2 +- .../TrailingWhitespacesInHeadersFuzzer.java | 2 +- .../generator/simple/NumberGenerator.java | 55 ++++++------- .../com/endava/cats/io/ServiceCaller.java | 4 +- .../com/endava/cats/model/CatsRequest.java | 2 +- .../endava/cats/model/FuzzingStrategy.java | 43 +++++----- .../model/generator/PayloadGenerator.java | 2 +- .../model/strategy/InsertFuzzingStrategy.java | 4 +- .../model/strategy/NoopFuzzingStrategy.java | 2 +- .../model/strategy/PrefixFuzzingStrategy.java | 4 +- .../strategy/ReplaceFuzzingStrategy.java | 2 +- .../model/strategy/SkipFuzzingStrategy.java | 2 +- .../model/strategy/TrailFuzzingStrategy.java | 4 +- .../java/com/endava/cats/util/CatsUtil.java | 4 +- .../endava/cats/command/CatsCommandTest.java | 2 +- .../NamingsContractInfoFuzzerTest.java | 1 - ...tringFieldsSanitizeValidateFuzzerTest.java | 2 +- ...tringFieldsValidateSanitizeFuzzerTest.java | 2 +- .../DecimalFieldsLeftBoundaryFuzzerTest.java | 2 - .../DecimalFieldsRightBoundaryFuzzerTest.java | 2 - ...ecimalValuesInIntegerFieldsFuzzerTest.java | 2 - .../EmptyStringValuesInFieldsFuzzerTest.java | 2 +- ...eNegativeValueDecimalFieldsFuzzerTest.java | 3 +- ...eNegativeValueIntegerFieldsFuzzerTest.java | 2 - ...ePositiveValueDecimalFieldsFuzzerTest.java | 2 - ...ositiveValueInIntegerFieldsFuzzerTest.java | 2 - .../fuzzer/fields/FunctionalFuzzerTest.java | 6 +- .../IntegerFieldsLeftBoundaryFuzzerTest.java | 2 - .../IntegerFieldsRightBoundaryFuzzerTest.java | 2 - ...thExactValuesInStringFieldsFuzzerTest.java | 2 +- ...mExactValuesInNumericFieldsFuzzerTest.java | 2 +- ...thExactValuesInStringFieldsFuzzerTest.java | 2 +- ...mExactValuesInNumericFieldsFuzzerTest.java | 2 +- ...yLargeUnicodeValuesInFieldsFuzzerTest.java | 4 +- .../VeryLargeValuesInFieldsFuzzerTest.java | 2 +- ...tringFieldsSanitizeValidateFuzzerTest.java | 2 +- ...tringFieldsValidateSanitizeFuzzerTest.java | 2 +- .../base/BaseBoundaryFieldFuzzerTest.java | 8 +- .../fields/base/BaseFieldsFuzzerTest.java | 7 +- ...olCharsInFieldsTrimValidateFuzzerTest.java | 2 +- ...olCharsInFieldsValidateTrimFuzzerTest.java | 2 +- ...tEmojisInFieldsTrimValidateFuzzerTest.java | 2 +- ...tEmojisInFieldsValidateTrimFuzzerTest.java | 2 +- ...tEmojisInFieldsTrimValidateFuzzerTest.java | 2 +- ...tEmojisInFieldsValidateTrimFuzzerTest.java | 2 +- ...espacesInFieldsTrimValidateFuzzerTest.java | 2 +- ...espacesInFieldsValidateTrimFuzzerTest.java | 4 +- .../within/CommonWithinMethodsTest.java | 4 +- ...arsInFieldsSanitizeValidateFuzzerTest.java | 2 +- ...arsInFieldsValidateSanitizeFuzzerTest.java | 2 +- ...tEmojisInFieldsTrimValidateFuzzerTest.java | 2 +- ...tEmojisInFieldsValidateTrimFuzzerTest.java | 2 +- ...tEmojisInFieldsTrimValidateFuzzerTest.java | 2 +- ...tEmojisInFieldsValidateTrimFuzzerTest.java | 2 +- .../CheckSecurityHeadersFuzzerTest.java | 2 +- .../headers/DuplicateHeaderFuzzerTest.java | 2 +- .../fuzzer/headers/ExtraHeaderFuzzerTest.java | 2 +- .../headers/RemoveHeadersFuzzerTest.java | 2 +- ...upportedContentTypesHeadersFuzzerTest.java | 2 +- ...LargeUnicodeValuesInHeadersFuzzerTest.java | 2 +- .../VeryLargeValuesInHeadersFuzzerTest.java | 2 +- .../headers/base/BaseHeadersFuzzerTest.java | 2 +- .../http/BypassAuthenticationFuzzerTest.java | 2 +- .../fuzzer/http/DummyRequestFuzzerTest.java | 2 +- .../cats/fuzzer/http/HappyFuzzerTest.java | 2 +- .../fuzzer/http/HttpMethodsFuzzerTest.java | 2 +- .../fuzzer/http/MalformedJsonFuzzerTest.java | 2 +- .../http/NonRestHttpMethodsFuzzerTest.java | 2 +- .../generator/simple/NumberGeneratorTest.java | 82 +++++++++---------- .../cats/model/FuzzingStrategyTest.java | 18 ++-- 141 files changed, 278 insertions(+), 307 deletions(-) diff --git a/src/main/java/com/endava/cats/fuzzer/fields/BooleanFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/BooleanFieldsFuzzer.java index a4ac614af..2059dd639 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/BooleanFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/BooleanFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.StringGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzer.java index b4805472b..5695d7d81 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -29,7 +29,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.generateLeftBoundaryDecimalValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzer.java index 5c214211c..05e95621a 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -29,7 +29,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.generateRightBoundaryDecimalValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzer.java index 33e2f5b00..592eeca42 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -35,7 +35,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.generateDecimalValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzer.java index 6e045d9b9..c795a19ec 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -34,7 +34,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Object getBoundaryValue(Schema schema) { return NumberGenerator.getExtremeNegativeDecimalValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzer.java index 2fd17fc9e..65760c1d7 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -34,7 +34,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.getExtremeNegativeIntegerValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzer.java index ac3089a2f..ef781bcdb 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -35,7 +35,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.getExtremePositiveDecimalValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzer.java index dd256a23a..78dc09012 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -34,7 +34,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.getExtremePositiveIntegerValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzer.java index 7d4675bd9..38f58bca0 100755 --- a/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -29,7 +29,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.generateLeftBoundaryIntegerValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzer.java index 00e24454e..9686b1281 100755 --- a/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.NumberGenerator; import com.endava.cats.io.ServiceCaller; @@ -29,7 +29,7 @@ public List> getSchemasThatTheFuzzerWillApplyTo() { } @Override - public String getBoundaryValue(Schema schema) { + public Number getBoundaryValue(Schema schema) { return NumberGenerator.generateRightBoundaryIntegerValue(schema); } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/InvalidValuesInEnumsFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/InvalidValuesInEnumsFieldsFuzzer.java index 9fba57f97..96e94d19a 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/InvalidValuesInEnumsFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/InvalidValuesInEnumsFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.StringGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzer.java index d95a180b5..b9620cca6 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.ExactValuesInFieldsFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzer.java index b8f254d84..573e0361c 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.ExactValuesInFieldsFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzer.java index 8b7954f40..2e68d6c25 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.ExactValuesInFieldsFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzer.java index 4af9d05d9..9f5f6c47c 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.ExactValuesInFieldsFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/RemoveFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/RemoveFieldsFuzzer.java index dcd5e657c..d0d6d4bef 100755 --- a/src/main/java/com/endava/cats/fuzzer/fields/RemoveFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/RemoveFieldsFuzzer.java @@ -10,8 +10,8 @@ import com.endava.cats.io.ServiceData; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.JsonUtils; +import com.endava.cats.report.TestCaseListener; import io.github.ludovicianul.prettylogger.PrettyLogger; import io.github.ludovicianul.prettylogger.PrettyLoggerFactory; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsLeftBoundaryFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsLeftBoundaryFuzzer.java index c5717ab6e..2eaee5456 100755 --- a/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsLeftBoundaryFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsLeftBoundaryFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.StringGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsRightBoundaryFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsRightBoundaryFuzzer.java index 1f12a7ec3..304ffb1c8 100755 --- a/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsRightBoundaryFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/StringFieldsRightBoundaryFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.StringGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/StringFormatAlmostValidValuesFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/StringFormatAlmostValidValuesFuzzer.java index 6143c6344..47273651a 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/StringFormatAlmostValidValuesFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/StringFormatAlmostValidValuesFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.format.FormatGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/StringFormatTotallyWrongValuesFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/StringFormatTotallyWrongValuesFuzzer.java index f0651c226..46cd373eb 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/StringFormatTotallyWrongValuesFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/StringFormatTotallyWrongValuesFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.format.FormatGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/StringsInNumericFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/StringsInNumericFieldsFuzzer.java index 812b3ceea..74f679804 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/StringsInNumericFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/StringsInNumericFieldsFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.fields; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.BaseBoundaryFieldFuzzer; import com.endava.cats.generator.simple.StringGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzer.java index 38c88edda..a4b8c6315 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields; +import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.args.FilesArguments; import com.endava.cats.args.ProcessingArguments; -import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.fuzzer.fields.base.ExpectOnly4XXBaseFieldsFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzer.java index fe86e1343..98f6b429b 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzer.java @@ -1,8 +1,8 @@ package com.endava.cats.fuzzer.fields; +import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.args.FilesArguments; import com.endava.cats.args.ProcessingArguments; -import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.fuzzer.fields.base.ExpectOnly4XXBaseFieldsFuzzer; import com.endava.cats.generator.simple.StringGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzer.java index aa890aebc..f4cd76a24 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzer.java @@ -102,7 +102,7 @@ private boolean isRequestSchemaMatchingFuzzerType(Schema schema) { * @param schema used to extract boundary information * @return a value to be used for fuzzing */ - public abstract String getBoundaryValue(Schema schema); + public abstract Object getBoundaryValue(Schema schema); /** * Override this to provide information about whether the current field has boundaries defined or not. For example a String diff --git a/src/main/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzer.java index 0c153c86d..a67b6e622 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzer.java @@ -77,7 +77,7 @@ protected void process(FuzzingData data, String fuzzedField, FuzzingStrategy fuz if (this.isFuzzingPossible(data, fuzzedField, fuzzingStrategy)) { logger.debug("Fuzzing possible..."); FuzzingResult fuzzingResult = catsUtil.replaceField(data.getPayload(), fuzzedField, fuzzingStrategy); - boolean isFuzzedValueMatchingPattern = this.isFuzzedValueMatchingPattern(fuzzingResult.getFuzzedValue(), data, fuzzedField); + boolean isFuzzedValueMatchingPattern = this.isFuzzedValueMatchingPattern(String.valueOf(fuzzingResult.getFuzzedValue()), data, fuzzedField); ServiceData serviceData = ServiceData.builder().relativePath(data.getPath()) .headers(data.getHeaders()).payload(fuzzingResult.getJson()).httpMethod(data.getMethod()) @@ -92,7 +92,7 @@ protected void process(FuzzingData data, String fuzzedField, FuzzingStrategy fuz } else { logger.debug("Fuzzing not possible!"); FuzzingStrategy strategy = this.createSkipStrategy(fuzzingStrategy); - testCaseListener.skipTest(logger, strategy.process("")); + testCaseListener.skipTest(logger, (String) strategy.process("")); } } diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsTrimValidateFuzzer.java index be29d8be9..6fd598a16 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsTrimValidateFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsValidateTrimFuzzer.java index dba2f5119..233377cf3 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingControlCharsInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java index bd81d0b7d..54d7daa35 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java index 9e8bdb0f1..af532a82a 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java index 521b6180d..019ce7e59 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java index 8df3a37ee..152ba9a3e 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsTrimValidateFuzzer.java index 7a1c69829..cb26ec50e 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsTrimValidateFuzzer.java @@ -1,16 +1,16 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; import com.endava.cats.annotations.WhitespaceFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsValidateTrimFuzzer.java index 2e1a9a8df..4f7fbcc4f 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/leading/LeadingWhitespacesInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.leading; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; import com.endava.cats.annotations.WhitespaceFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/InvisibleCharsOnlyTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/InvisibleCharsOnlyTrimValidateFuzzer.java index f796b1f69..d76c3e293 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/InvisibleCharsOnlyTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/InvisibleCharsOnlyTrimValidateFuzzer.java @@ -3,12 +3,12 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; import com.endava.cats.fuzzer.fields.base.Expect4XXForRequiredBaseFieldsFuzzer; -import com.endava.cats.http.ResponseCodeFamily; -import com.endava.cats.model.generator.PayloadGenerator; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.generator.PayloadGenerator; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzer.java index 7c40c0991..334a34c6f 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzer.java index 821602fc0..ab7bd4b1d 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzer.java index 48ed01ea7..dcafa101e 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzer.java index b15ed105d..a0b85a931 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzer.java index a0f24453f..76f704be1 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzer.java index 8555eb523..ab90ab488 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzer.java index 8d058ed2c..d85ed75f0 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; import com.endava.cats.annotations.WhitespaceFuzzer; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzer.java index c110745c0..046ce7cf4 100755 --- a/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzer.java @@ -1,14 +1,14 @@ package com.endava.cats.fuzzer.fields.only; -import com.endava.cats.args.FilesArguments; -import com.endava.cats.args.IgnoreArguments; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; import com.endava.cats.annotations.WhitespaceFuzzer; +import com.endava.cats.args.FilesArguments; +import com.endava.cats.args.IgnoreArguments; import com.endava.cats.io.ServiceCaller; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsTrimValidateFuzzer.java index 7e3d5073c..08cbcd879 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsTrimValidateFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsValidateTrimFuzzer.java index cc25e8ec5..df1ecf7bb 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingControlCharsInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java index d52cca688..fc7015189 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsTrimValidateFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java index 5b1ac990c..bf21fd692 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingMultiCodePointEmojisInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java index 763a8e1f3..859968bdf 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsTrimValidateFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java index 2334c08a6..e5a0cd014 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingSingleCodePointEmojisInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsTrimValidateFuzzer.java index 684dca35b..feeaeb65b 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsTrimValidateFuzzer.java @@ -1,15 +1,15 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.TrimAndValidate; import com.endava.cats.annotations.WhitespaceFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsValidateTrimFuzzer.java index 55d277c39..9685e7590 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/trailing/TrailingWhitespacesInFieldsValidateTrimFuzzer.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.fields.trailing; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndTrim; import com.endava.cats.annotations.WhitespaceFuzzer; +import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.report.TestCaseListener; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzer.java index 0a8159d70..1f5065b2b 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzer.java @@ -1,17 +1,17 @@ package com.endava.cats.fuzzer.fields.within; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.SanitizeAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.CommonWithinMethods; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzer.java index a316272a1..2cd17ce58 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzer.java @@ -1,18 +1,18 @@ package com.endava.cats.fuzzer.fields.within; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.ControlCharFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndSanitize; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.CommonWithinMethods; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzer.java index c07806a0d..6945381a0 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzer.java @@ -1,17 +1,17 @@ package com.endava.cats.fuzzer.fields.within; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.SanitizeAndValidate; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.CommonWithinMethods; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzer.java b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzer.java index 36a79b207..fb448a897 100644 --- a/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzer.java @@ -1,18 +1,18 @@ package com.endava.cats.fuzzer.fields.within; -import com.endava.cats.args.FilesArguments; import com.endava.cats.annotations.EmojiFuzzer; import com.endava.cats.annotations.FieldFuzzer; import com.endava.cats.annotations.ValidateAndSanitize; +import com.endava.cats.args.FilesArguments; import com.endava.cats.fuzzer.fields.base.InvisibleCharsBaseTrimValidateFuzzer; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.CommonWithinMethods; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.model.util.PayloadUtils; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.model.util.PayloadUtils; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzer.java index 618554b96..3631d9e6a 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzer.java @@ -1,12 +1,12 @@ package com.endava.cats.fuzzer.headers; -import com.endava.cats.args.ProcessingArguments; import com.endava.cats.annotations.HeaderFuzzer; +import com.endava.cats.args.ProcessingArguments; import com.endava.cats.fuzzer.headers.base.ExpectOnly4XXBaseHeadersFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzer.java index 96180be45..e2657c4c6 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzer.java @@ -1,7 +1,7 @@ package com.endava.cats.fuzzer.headers; -import com.endava.cats.args.ProcessingArguments; import com.endava.cats.annotations.HeaderFuzzer; +import com.endava.cats.args.ProcessingArguments; import com.endava.cats.fuzzer.headers.base.ExpectOnly4XXBaseHeadersFuzzer; import com.endava.cats.generator.simple.StringGenerator; import com.endava.cats.io.ServiceCaller; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzer.java index 3ae341419..9dc68f2d0 100755 --- a/src/main/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzer.java @@ -46,7 +46,7 @@ public void fuzz(FuzzingData fuzzingData) { private void process(FuzzingData data, Set clonedHeaders, CatsHeader header, FuzzingStrategy fuzzingStrategy) { String previousHeaderValue = header.getValue(); - header.withValue(fuzzingStrategy.process(previousHeaderValue)); + header.withValue(String.valueOf(fuzzingStrategy.process(previousHeaderValue))); try { boolean isRequiredHeaderFuzzed = clonedHeaders.stream().filter(CatsHeader::isRequired).collect(Collectors.toList()).contains(header); diff --git a/src/main/java/com/endava/cats/fuzzer/headers/base/BaseSecurityChecksHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/base/BaseSecurityChecksHeadersFuzzer.java index 6eb30daa6..6fb6c355f 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/base/BaseSecurityChecksHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/base/BaseSecurityChecksHeadersFuzzer.java @@ -1,8 +1,8 @@ package com.endava.cats.fuzzer.headers.base; import com.endava.cats.Fuzzer; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.generator.Cloner; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.io.ServiceData; import com.endava.cats.model.CatsHeader; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingControlCharsInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingControlCharsInHeadersFuzzer.java index f1289a565..21402ccce 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingControlCharsInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingControlCharsInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingMultiCodePointEmojisInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingMultiCodePointEmojisInHeadersFuzzer.java index 4e340e141..ce1485a18 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingMultiCodePointEmojisInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingMultiCodePointEmojisInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSingleCodePointEmojisInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSingleCodePointEmojisInHeadersFuzzer.java index a5ee86ece..3eb1e9e00 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSingleCodePointEmojisInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSingleCodePointEmojisInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSpacesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSpacesInHeadersFuzzer.java index 8e0772ae5..99b948aac 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSpacesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingSpacesInHeadersFuzzer.java @@ -4,8 +4,8 @@ import com.endava.cats.fuzzer.headers.base.SpacesCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.ArrayList; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingWhitespacesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingWhitespacesInHeadersFuzzer.java index 190a974fc..86451a62f 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingWhitespacesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/leading/LeadingWhitespacesInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyControlCharsInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyControlCharsInHeadersFuzzer.java index 3b189241b..c9c90fe84 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyControlCharsInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyControlCharsInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyMultiCodePointEmojisInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyMultiCodePointEmojisInHeadersFuzzer.java index c51a8ac62..5e72ffa6d 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyMultiCodePointEmojisInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyMultiCodePointEmojisInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySingleCodePointEmojisInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySingleCodePointEmojisInHeadersFuzzer.java index 045c315e8..465b27702 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySingleCodePointEmojisInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySingleCodePointEmojisInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySpacesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySpacesInHeadersFuzzer.java index edd2f60dd..cc95301e1 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySpacesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlySpacesInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyWhitespacesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyWhitespacesInHeadersFuzzer.java index 46c969883..e3cb0fec4 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyWhitespacesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/only/OnlyWhitespacesInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingControlCharsInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingControlCharsInHeadersFuzzer.java index ea388e423..98a6c24ac 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingControlCharsInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingControlCharsInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.ArrayList; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingMultiCodePointEmojisHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingMultiCodePointEmojisHeadersFuzzer.java index e821ab7de..5ab729d18 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingMultiCodePointEmojisHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingMultiCodePointEmojisHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSingleCodePointEmojisHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSingleCodePointEmojisHeadersFuzzer.java index 763c8f55e..69c09d3da 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSingleCodePointEmojisHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSingleCodePointEmojisHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSpacesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSpacesInHeadersFuzzer.java index 890e29f03..78bf14c72 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSpacesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingSpacesInHeadersFuzzer.java @@ -4,8 +4,8 @@ import com.endava.cats.fuzzer.headers.base.SpacesCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingWhitespacesInHeadersFuzzer.java b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingWhitespacesInHeadersFuzzer.java index 984f0af2e..e907de87a 100644 --- a/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingWhitespacesInHeadersFuzzer.java +++ b/src/main/java/com/endava/cats/fuzzer/headers/trailing/TrailingWhitespacesInHeadersFuzzer.java @@ -5,8 +5,8 @@ import com.endava.cats.fuzzer.headers.base.InvisibleCharsBaseFuzzer; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingStrategy; -import com.endava.cats.report.TestCaseListener; import com.endava.cats.model.util.PayloadUtils; +import com.endava.cats.report.TestCaseListener; import javax.inject.Singleton; import java.util.List; diff --git a/src/main/java/com/endava/cats/generator/simple/NumberGenerator.java b/src/main/java/com/endava/cats/generator/simple/NumberGenerator.java index b5f798b31..de0df647c 100755 --- a/src/main/java/com/endava/cats/generator/simple/NumberGenerator.java +++ b/src/main/java/com/endava/cats/generator/simple/NumberGenerator.java @@ -18,27 +18,20 @@ private NumberGenerator() { //ntd } - public static String generateLeftBoundaryIntegerValue(Schema schema) { - BigDecimal result = generateLeftBoundaryValue(schema, new BigDecimal(TEN_THOUSANDS)); - - return String.valueOf(result.toBigInteger()); + public static Number generateLeftBoundaryIntegerValue(Schema schema) { + return generateLeftBoundaryValue(schema, new BigDecimal(TEN_THOUSANDS)); } - public static String generateLeftBoundaryDecimalValue(Schema schema) { - BigDecimal result = generateLeftBoundaryValue(schema, DECIMAL_CONSTANT); - - return String.valueOf(result); + public static Number generateLeftBoundaryDecimalValue(Schema schema) { + return generateLeftBoundaryValue(schema, DECIMAL_CONSTANT); } - public static String generateRightBoundaryDecimalValue(Schema schema) { - BigDecimal result = generateRightBoundaryValue(schema, DECIMAL_CONSTANT); - return String.valueOf(result); + public static Number generateRightBoundaryDecimalValue(Schema schema) { + return generateRightBoundaryValue(schema, DECIMAL_CONSTANT); } - public static String generateRightBoundaryIntegerValue(Schema schema) { - BigDecimal result = generateRightBoundaryValue(schema, new BigDecimal(TEN_THOUSANDS)); - - return String.valueOf(result.toBigInteger()); + public static Number generateRightBoundaryIntegerValue(Schema schema) { + return generateRightBoundaryValue(schema, new BigDecimal(TEN_THOUSANDS)); } private static BigDecimal generateRightBoundaryValue(Schema schema, BigDecimal toAdd) { @@ -57,39 +50,39 @@ private static BigDecimal generateLeftBoundaryValue(Schema schema, BigDecimal to return new BigDecimal(Long.MIN_VALUE).subtract(BigDecimal.TEN); } - public static String getExtremeNegativeIntegerValue(Schema schema) { + public static Number getExtremeNegativeIntegerValue(Schema schema) { if (schema.getFormat() == null || schema.getFormat().equalsIgnoreCase("int32")) { - return String.valueOf(Long.MIN_VALUE); + return Long.MIN_VALUE; } - return String.valueOf(MOST_NEGATIVE_INTEGER); + return MOST_NEGATIVE_INTEGER; } - public static String getExtremePositiveIntegerValue(Schema schema) { + public static Number getExtremePositiveIntegerValue(Schema schema) { if (schema.getFormat() == null || schema.getFormat().equalsIgnoreCase("int32")) { - return String.valueOf(Long.MAX_VALUE); + return Long.MAX_VALUE; } - return String.valueOf(MOST_POSITIVE_INTEGER); + return MOST_POSITIVE_INTEGER; } - public static String getExtremePositiveDecimalValue(Schema schema) { + public static Number getExtremePositiveDecimalValue(Schema schema) { if (schema.getFormat() == null) { - return String.valueOf(MOST_POSITIVE_DECIMAL); + return MOST_POSITIVE_DECIMAL; } else if (schema.getFormat().equalsIgnoreCase("float")) { - return String.valueOf(Float.MAX_VALUE); + return Float.MAX_VALUE; } - return String.valueOf(Double.MAX_VALUE); + return Double.MAX_VALUE; } - public static String getExtremeNegativeDecimalValue(Schema schema) { + public static Number getExtremeNegativeDecimalValue(Schema schema) { if (schema.getFormat() == null) { - return String.valueOf(MOST_NEGATIVE_DECIMAL); + return MOST_NEGATIVE_DECIMAL; } else if (schema.getFormat().equalsIgnoreCase("float")) { - return String.valueOf(-Float.MAX_VALUE); + return -Float.MAX_VALUE; } - return String.valueOf(-Double.MAX_VALUE); + return -Double.MAX_VALUE; } - public static String generateDecimalValue(Schema schema) { + public static Number generateDecimalValue(Schema schema) { BigDecimal minimum = BigDecimal.ZERO; if (schema.getMinimum() != null) { @@ -97,6 +90,6 @@ public static String generateDecimalValue(Schema schema) { } BigDecimal randomBigDecimal = minimum.add(BigDecimal.valueOf(Math.random())); - return String.valueOf(randomBigDecimal.doubleValue()); + return randomBigDecimal.doubleValue(); } } diff --git a/src/main/java/com/endava/cats/io/ServiceCaller.java b/src/main/java/com/endava/cats/io/ServiceCaller.java index 53380632b..197344797 100755 --- a/src/main/java/com/endava/cats/io/ServiceCaller.java +++ b/src/main/java/com/endava/cats/io/ServiceCaller.java @@ -337,7 +337,7 @@ public CatsResponse callService(CatsRequest catsRequest, Set fuzzedField long startTime = System.currentTimeMillis(); RequestBody requestBody = null; Headers.Builder headers = new Headers.Builder(); - catsRequest.getHeaders().forEach(header -> headers.addUnsafeNonAscii(header.getName(), header.getValue())); + catsRequest.getHeaders().forEach(header -> headers.addUnsafeNonAscii(header.getName(), String.valueOf(header.getValue()))); if (HttpMethod.requiresBody(catsRequest.getHttpMethod())) { requestBody = RequestBody.create(catsRequest.getPayload().getBytes(StandardCharsets.UTF_8)); @@ -509,7 +509,7 @@ private void replaceHeaderIfNotFuzzed(List headers, ServiceD } else { /* There are 2 cases when we want to mix the supplied header with the fuzzed one: if the fuzzing is TRAIL or PREFIX we want to try this behaviour on a valid header value */ CatsRequest.Header existingHeader = headers.stream().filter(header -> header.getName().equalsIgnoreCase(suppliedHeader.getKey())).findFirst().orElse(new CatsRequest.Header("", "")); - String finalHeaderValue = FuzzingStrategy.mergeFuzzing(existingHeader.getValue(), suppliedHeader.getValue()); + Object finalHeaderValue = FuzzingStrategy.mergeFuzzing(existingHeader.getValue(), suppliedHeader.getValue()); headers.removeIf(header -> header.getName().equalsIgnoreCase(suppliedHeader.getKey())); headers.add(new CatsRequest.Header(suppliedHeader.getKey(), finalHeaderValue)); LOGGER.note("Header's [{}] fuzzing will merge with the supplied header value from headers.yml. Final header value {}", suppliedHeader.getKey(), finalHeaderValue); diff --git a/src/main/java/com/endava/cats/model/CatsRequest.java b/src/main/java/com/endava/cats/model/CatsRequest.java index 60083535a..19c22624e 100755 --- a/src/main/java/com/endava/cats/model/CatsRequest.java +++ b/src/main/java/com/endava/cats/model/CatsRequest.java @@ -32,6 +32,6 @@ public static CatsRequest empty() { @ToString public static class Header { private final String name; - private final String value; + private final Object value; } } diff --git a/src/main/java/com/endava/cats/model/FuzzingStrategy.java b/src/main/java/com/endava/cats/model/FuzzingStrategy.java index eed0b1278..f326afae1 100644 --- a/src/main/java/com/endava/cats/model/FuzzingStrategy.java +++ b/src/main/java/com/endava/cats/model/FuzzingStrategy.java @@ -25,7 +25,7 @@ public abstract class FuzzingStrategy { private static final Pattern ALL = Pattern.compile("^[\\p{C}\\p{Z}\\p{So}\\p{Sk}\\p{M}]+[\\p{C}\\p{Z}\\p{So}\\p{Sk}\\p{M}]*$"); private static final Pattern WITHIN = Pattern.compile("[\\p{C}\\p{Z}\\p{So}\\p{Sk}\\p{M}]+"); - protected String data; + protected Object data; public static FuzzingStrategy prefix() { return new PrefixFuzzingStrategy(); @@ -51,31 +51,32 @@ public static FuzzingStrategy insert() { return new InsertFuzzingStrategy(); } - public static String mergeFuzzing(String fuzzedValue, String suppliedValue) { + public static Object mergeFuzzing(Object fuzzedValue, Object suppliedValue) { FuzzingStrategy currentStrategy = fromValue(fuzzedValue); return currentStrategy.process(suppliedValue); } - public static FuzzingStrategy fromValue(String value) { - if (StringUtils.isBlank(value) || ALL.matcher(value).matches()) { - return replace().withData(value); + public static FuzzingStrategy fromValue(Object valueObject) { + String valueAsString = String.valueOf(valueObject); + if (StringUtils.isBlank(valueAsString) || ALL.matcher(valueAsString).matches()) { + return replace().withData(valueObject); } - if (isUnicodeControlChar(value.charAt(0)) || isUnicodeWhitespace(value.charAt(0)) || isUnicodeOtherSymbol(value.charAt(0))) { - return prefix().withData(replaceSpecialCharsWithEmpty(value)); + if (isUnicodeControlChar(valueAsString.charAt(0)) || isUnicodeWhitespace(valueAsString.charAt(0)) || isUnicodeOtherSymbol(valueAsString.charAt(0))) { + return prefix().withData(replaceSpecialCharsWithEmpty(valueAsString)); } - if (isUnicodeControlChar(value.charAt(value.length() - 1)) || isUnicodeWhitespace(value.charAt(value.length() - 1)) || isUnicodeOtherSymbol(value.charAt(value.length() - 1))) { - return trail().withData(replaceSpecialCharsWithEmpty(value)); + if (isUnicodeControlChar(valueAsString.charAt(valueAsString.length() - 1)) || isUnicodeWhitespace(valueAsString.charAt(valueAsString.length() - 1)) || isUnicodeOtherSymbol(valueAsString.charAt(valueAsString.length() - 1))) { + return trail().withData(replaceSpecialCharsWithEmpty(valueAsString)); } - if (isLargeString(value)) { - return replace().withData(value); + if (isLargeString(valueAsString)) { + return replace().withData(valueObject); } - Matcher withinMatcher = WITHIN.matcher(value); + Matcher withinMatcher = WITHIN.matcher(valueAsString); if (withinMatcher.find()) { return insert().withData(withinMatcher.group()); } - return replace().withData(value); + return replace().withData(valueObject); } private static String replaceSpecialCharsWithEmpty(String value) { @@ -115,12 +116,12 @@ public static boolean isLargeString(String data) { return data.startsWith("ca") && data.endsWith("ts"); } - public FuzzingStrategy withData(String inner) { + public FuzzingStrategy withData(Object inner) { this.data = inner; return this; } - public String getData() { + public Object getData() { return this.data; } @@ -138,20 +139,16 @@ public String toString() { public String truncatedValue() { if (data != null) { - String toPrint = data; - if (data.length() > 30) { - toPrint = data.substring(0, 30) + "..."; + String toPrint = String.valueOf(data); + if (toPrint.length() > 30) { + toPrint = toPrint.substring(0, 30) + "..."; } return this.name() + " with " + formatValue(toPrint); } return this.name(); } - public String process(Object value) { - return this.process(String.valueOf(value)); - } - - public abstract String process(String value); + public abstract Object process(Object value); public abstract String name(); } diff --git a/src/main/java/com/endava/cats/model/generator/PayloadGenerator.java b/src/main/java/com/endava/cats/model/generator/PayloadGenerator.java index 384782309..959e27013 100644 --- a/src/main/java/com/endava/cats/model/generator/PayloadGenerator.java +++ b/src/main/java/com/endava/cats/model/generator/PayloadGenerator.java @@ -237,7 +237,7 @@ private Object getExampleFromNumberSchema(Schema property) { Double min = property.getMinimum() == null ? null : property.getMinimum().doubleValue(); Double max = property.getMaximum() == null ? null : property.getMaximum().doubleValue(); - return df.format(randomNumber(min, max)); + return randomNumber(min, max); } private Object getExampleFromBooleanSchema(Schema property) { diff --git a/src/main/java/com/endava/cats/model/strategy/InsertFuzzingStrategy.java b/src/main/java/com/endava/cats/model/strategy/InsertFuzzingStrategy.java index 03157f5e2..78f314063 100644 --- a/src/main/java/com/endava/cats/model/strategy/InsertFuzzingStrategy.java +++ b/src/main/java/com/endava/cats/model/strategy/InsertFuzzingStrategy.java @@ -5,8 +5,8 @@ public class InsertFuzzingStrategy extends FuzzingStrategy { @Override - public String process(String value) { - return CommonWithinMethods.insertInTheMiddle(value, data, true); + public Object process(Object value) { + return CommonWithinMethods.insertInTheMiddle(String.valueOf(value), String.valueOf(data), true); } @Override diff --git a/src/main/java/com/endava/cats/model/strategy/NoopFuzzingStrategy.java b/src/main/java/com/endava/cats/model/strategy/NoopFuzzingStrategy.java index 908deb9d4..a9c25ba7e 100644 --- a/src/main/java/com/endava/cats/model/strategy/NoopFuzzingStrategy.java +++ b/src/main/java/com/endava/cats/model/strategy/NoopFuzzingStrategy.java @@ -4,7 +4,7 @@ public class NoopFuzzingStrategy extends FuzzingStrategy { @Override - public String process(String value) { + public Object process(Object value) { return value; } diff --git a/src/main/java/com/endava/cats/model/strategy/PrefixFuzzingStrategy.java b/src/main/java/com/endava/cats/model/strategy/PrefixFuzzingStrategy.java index b55baa852..7795dd2af 100644 --- a/src/main/java/com/endava/cats/model/strategy/PrefixFuzzingStrategy.java +++ b/src/main/java/com/endava/cats/model/strategy/PrefixFuzzingStrategy.java @@ -4,8 +4,8 @@ public class PrefixFuzzingStrategy extends FuzzingStrategy { @Override - public String process(String value) { - return data + value; + public Object process(Object value) { + return String.valueOf(data) + String.valueOf(value); } @Override diff --git a/src/main/java/com/endava/cats/model/strategy/ReplaceFuzzingStrategy.java b/src/main/java/com/endava/cats/model/strategy/ReplaceFuzzingStrategy.java index 1290e736c..fb7f7c39e 100644 --- a/src/main/java/com/endava/cats/model/strategy/ReplaceFuzzingStrategy.java +++ b/src/main/java/com/endava/cats/model/strategy/ReplaceFuzzingStrategy.java @@ -5,7 +5,7 @@ public class ReplaceFuzzingStrategy extends FuzzingStrategy { @Override - public String process(String value) { + public Object process(Object value) { return data; } diff --git a/src/main/java/com/endava/cats/model/strategy/SkipFuzzingStrategy.java b/src/main/java/com/endava/cats/model/strategy/SkipFuzzingStrategy.java index 79aa47370..7da968e6f 100644 --- a/src/main/java/com/endava/cats/model/strategy/SkipFuzzingStrategy.java +++ b/src/main/java/com/endava/cats/model/strategy/SkipFuzzingStrategy.java @@ -4,7 +4,7 @@ public class SkipFuzzingStrategy extends FuzzingStrategy { @Override - public String process(String value) { + public Object process(Object value) { return data; } diff --git a/src/main/java/com/endava/cats/model/strategy/TrailFuzzingStrategy.java b/src/main/java/com/endava/cats/model/strategy/TrailFuzzingStrategy.java index e923c3acd..4dc7f0e16 100644 --- a/src/main/java/com/endava/cats/model/strategy/TrailFuzzingStrategy.java +++ b/src/main/java/com/endava/cats/model/strategy/TrailFuzzingStrategy.java @@ -4,8 +4,8 @@ public class TrailFuzzingStrategy extends FuzzingStrategy { @Override - public String process(String value) { - return value + data; + public Object process(Object value) { + return String.valueOf(value) + String.valueOf(data); } @Override diff --git a/src/main/java/com/endava/cats/util/CatsUtil.java b/src/main/java/com/endava/cats/util/CatsUtil.java index 860d8f2a1..45cb674db 100644 --- a/src/main/java/com/endava/cats/util/CatsUtil.java +++ b/src/main/java/com/endava/cats/util/CatsUtil.java @@ -98,13 +98,13 @@ public FuzzingResult replaceField(String payload, String jsonPropertyForReplacem } DocumentContext context = JsonPath.parse(payload); Object oldValue = context.read(JsonUtils.sanitizeToJsonPath(jsonPropToGetValue)); - String valueToSet = fuzzingStrategyToApply.process(oldValue); + Object valueToSet = fuzzingStrategyToApply.process(oldValue); if (mergeFuzzing) { valueToSet = FuzzingStrategy.mergeFuzzing(this.nullOrValueOf(oldValue), fuzzingStrategyToApply.getData()); } context.set(JsonUtils.sanitizeToJsonPath(jsonPropertyForReplacement), valueToSet); - return new FuzzingResult(context.jsonString(), valueToSet); + return new FuzzingResult(context.jsonString(), String.valueOf(valueToSet)); } return FuzzingResult.empty(); } diff --git a/src/test/java/com/endava/cats/command/CatsCommandTest.java b/src/test/java/com/endava/cats/command/CatsCommandTest.java index 4bef5c54e..98faa8cdd 100644 --- a/src/test/java/com/endava/cats/command/CatsCommandTest.java +++ b/src/test/java/com/endava/cats/command/CatsCommandTest.java @@ -4,9 +4,9 @@ import com.endava.cats.args.CheckArguments; import com.endava.cats.args.FilterArguments; import com.endava.cats.args.ReportingArguments; +import com.endava.cats.factory.FuzzingDataFactory; import com.endava.cats.fuzzer.contract.PathTagsContractInfoFuzzer; import com.endava.cats.http.HttpMethod; -import com.endava.cats.factory.FuzzingDataFactory; import com.endava.cats.report.ExecutionStatisticsListener; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; diff --git a/src/test/java/com/endava/cats/fuzzer/contract/NamingsContractInfoFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/contract/NamingsContractInfoFuzzerTest.java index 007adc01c..966d20a48 100644 --- a/src/test/java/com/endava/cats/fuzzer/contract/NamingsContractInfoFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/contract/NamingsContractInfoFuzzerTest.java @@ -21,7 +21,6 @@ import org.mockito.Mockito; import javax.enterprise.inject.Instance; -import java.util.List; import java.util.stream.Stream; @QuarkusTest diff --git a/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsSanitizeValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsSanitizeValidateFuzzerTest.java index 6200152af..f8a6566fc 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsSanitizeValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsSanitizeValidateFuzzerTest.java @@ -43,7 +43,7 @@ void shouldProperlyOverrideSuperClassMethods() { FuzzingStrategy fuzzingStrategy = abugidasCharsInStringFieldsSanitizeValidateFuzzer.getFieldFuzzingStrategy(data, "field").get(0); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.replace().name()); - Assertions.assertThat(fuzzingStrategy.getData()).contains("జ్ఞ\u200Cా"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("జ్ఞ\u200Cా"); Assertions.assertThat(abugidasCharsInStringFieldsSanitizeValidateFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.TWOXX); Assertions.assertThat(abugidasCharsInStringFieldsSanitizeValidateFuzzer.description()).isNotNull(); Assertions.assertThat(abugidasCharsInStringFieldsSanitizeValidateFuzzer.concreteFuzzStrategy().name()).isEqualTo(FuzzingStrategy.replace().name()); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsValidateSanitizeFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsValidateSanitizeFuzzerTest.java index c3e81ec50..f8022896b 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsValidateSanitizeFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/AbugidasInStringFieldsValidateSanitizeFuzzerTest.java @@ -41,7 +41,7 @@ void shouldProperlyOverrideSuperClassMethods() { Mockito.when(data.getRequestPropertyTypes()).thenReturn(reqTypes); FuzzingStrategy fuzzingStrategy = abugidasInStringFieldsValidateSanitizeFuzzer.getFieldFuzzingStrategy(data, "field").get(0); - Assertions.assertThat(fuzzingStrategy.getData()).contains("్ఞ\u200Cా"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("్ఞ\u200Cా"); Assertions.assertThat(abugidasInStringFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(abugidasInStringFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenOptionalFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(abugidasInStringFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenRequiredFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzerTest.java index 0ea4961f0..57a516fb8 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsLeftBoundaryFuzzerTest.java @@ -6,7 +6,6 @@ import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -33,7 +32,6 @@ void setup() { void givenANewDecimalFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheDecimalFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(decimalFieldsLeftBoundaryFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(NumberSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(decimalFieldsLeftBoundaryFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(decimalFieldsLeftBoundaryFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(decimalFieldsLeftBoundaryFuzzer.description()).isNotNull(); } diff --git a/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzerTest.java index f487c415f..b3bf58ea4 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/DecimalFieldsRightBoundaryFuzzerTest.java @@ -3,7 +3,6 @@ import com.endava.cats.model.FuzzingData; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -22,7 +21,6 @@ void setup() { void givenANewDecimalFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheDecimalFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(decimalFieldsRightBoundaryFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(NumberSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(decimalFieldsRightBoundaryFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(decimalFieldsRightBoundaryFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(decimalFieldsRightBoundaryFuzzer.description()).isNotNull(); } diff --git a/src/test/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzerTest.java index 9e033cabe..e22873258 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/DecimalValuesInIntegerFieldsFuzzerTest.java @@ -4,7 +4,6 @@ import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -23,7 +22,6 @@ void setup() { void givenANewDecimalFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheDecimalFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(decimalValuesInIntegerFieldsFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(IntegerSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(decimalValuesInIntegerFieldsFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(decimalValuesInIntegerFieldsFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(decimalValuesInIntegerFieldsFuzzer.description()).isNotNull(); Assertions.assertThat(decimalValuesInIntegerFieldsFuzzer.typeOfDataSentToTheService()).isNotNull(); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/EmptyStringValuesInFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/EmptyStringValuesInFieldsFuzzerTest.java index 329c923e2..18d825ecb 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/EmptyStringValuesInFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/EmptyStringValuesInFieldsFuzzerTest.java @@ -62,7 +62,7 @@ void givenANewEmptyStringFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBei FuzzingStrategy fuzzingStrategy = emptyStringValuesInFieldsFuzzer.getFieldFuzzingStrategy(null, null).get(0); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.replace().name()); - Assertions.assertThat(fuzzingStrategy.getData()).isEmpty(); + Assertions.assertThat(fuzzingStrategy.getData().toString()).isEmpty(); Assertions.assertThat(emptyStringValuesInFieldsFuzzer.description()).isNotNull(); Assertions.assertThat(emptyStringValuesInFieldsFuzzer.typeOfDataSentToTheService()).isNotNull(); } diff --git a/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzerTest.java index a08c09193..a781e0366 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueDecimalFieldsFuzzerTest.java @@ -3,7 +3,6 @@ import com.endava.cats.model.FuzzingData; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -21,7 +20,7 @@ void setup() { void givenANewExtremeNegativeValueDecimalFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheDecimalFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(extremeNegativeValueDecimalFieldsFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(NumberSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(extremeNegativeValueDecimalFieldsFuzzer.getBoundaryValue(nrSchema))).isTrue(); +// Assertions.assertThat(NumberUtils.isCreatable(extremeNegativeValueDecimalFieldsFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(extremeNegativeValueDecimalFieldsFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(extremeNegativeValueDecimalFieldsFuzzer.description()).isNotNull(); Assertions.assertThat(extremeNegativeValueDecimalFieldsFuzzer.typeOfDataSentToTheService()).isNotNull(); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzerTest.java index 254544e63..7bad5cc99 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/ExtremeNegativeValueIntegerFieldsFuzzerTest.java @@ -4,7 +4,6 @@ import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -23,7 +22,6 @@ void setup() { void givenANewExtremeNegativeValueIntegerFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheIntegerFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(extremeNegativeValueIntegerFieldsFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(IntegerSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(extremeNegativeValueIntegerFieldsFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(extremeNegativeValueIntegerFieldsFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(extremeNegativeValueIntegerFieldsFuzzer.description()).isNotNull(); Assertions.assertThat(extremeNegativeValueIntegerFieldsFuzzer.typeOfDataSentToTheService()).isNotNull(); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzerTest.java index f262665d7..464c05849 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueDecimalFieldsFuzzerTest.java @@ -3,7 +3,6 @@ import com.endava.cats.model.FuzzingData; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -22,7 +21,6 @@ void setup() { void givenANewExtremePositiveValueDecimalFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheDecimalFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(extremePositiveValueDecimalFieldsFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(NumberSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(extremePositiveValueDecimalFieldsFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(extremePositiveValueDecimalFieldsFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(extremePositiveValueDecimalFieldsFuzzer.description()).isNotNull(); Assertions.assertThat(extremePositiveValueDecimalFieldsFuzzer.typeOfDataSentToTheService()).isNotNull(); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzerTest.java index 2b43d00a5..e739a135a 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/ExtremePositiveValueInIntegerFieldsFuzzerTest.java @@ -4,7 +4,6 @@ import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -22,7 +21,6 @@ void setup() { void givenANewExtremePositiveValueIntegerFieldsFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheIntegerFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(extremePositiveValueInIntegerFields.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(IntegerSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(extremePositiveValueInIntegerFields.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(extremePositiveValueInIntegerFields.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(extremePositiveValueInIntegerFields.description()).isNotNull(); Assertions.assertThat(extremePositiveValueInIntegerFields.typeOfDataSentToTheService()).isNotNull(); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/FunctionalFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/FunctionalFuzzerTest.java index 0e8457a23..d6a0cd4a2 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/FunctionalFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/FunctionalFuzzerTest.java @@ -3,15 +3,15 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.dsl.CatsDSLParser; import com.endava.cats.dsl.CatsDSLWords; -import com.endava.cats.http.ResponseCodeFamily; +import com.endava.cats.fuzzer.CustomFuzzerUtil; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; -import com.endava.cats.fuzzer.CustomFuzzerUtil; import com.google.gson.JsonObject; import io.github.ludovicianul.prettylogger.PrettyLogger; import io.quarkus.test.junit.QuarkusTest; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzerTest.java index 88c6dce0f..17d207c18 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsLeftBoundaryFuzzerTest.java @@ -4,7 +4,6 @@ import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -22,7 +21,6 @@ void setup() { void givenANewIntegerFieldsLeftBoundaryFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheIntegerFieldsLeftBoundaryFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(integerFieldsLeftBoundaryFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(IntegerSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(integerFieldsLeftBoundaryFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(integerFieldsLeftBoundaryFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(integerFieldsLeftBoundaryFuzzer.description()).isNotNull(); } diff --git a/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzerTest.java index b6e6d91c8..f928f658b 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/IntegerFieldsRightBoundaryFuzzerTest.java @@ -4,7 +4,6 @@ import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.IntegerSchema; import io.swagger.v3.oas.models.media.NumberSchema; -import org.apache.commons.lang3.math.NumberUtils; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -22,7 +21,6 @@ void setup() { void givenANewIntegerFieldsRightBoundaryFuzzer_whenCreatingANewInstance_thenTheMethodsBeingOverriddenAreMatchingTheIntegerFieldsRightBoundaryFuzzer() { NumberSchema nrSchema = new NumberSchema(); Assertions.assertThat(integerFieldsRightBoundaryFuzzer.getSchemasThatTheFuzzerWillApplyTo().stream().anyMatch(schema -> schema.isAssignableFrom(IntegerSchema.class))).isTrue(); - Assertions.assertThat(NumberUtils.isCreatable(integerFieldsRightBoundaryFuzzer.getBoundaryValue(nrSchema))).isTrue(); Assertions.assertThat(integerFieldsRightBoundaryFuzzer.hasBoundaryDefined("test", FuzzingData.builder().build())).isTrue(); Assertions.assertThat(integerFieldsRightBoundaryFuzzer.description()).isNotNull(); } diff --git a/src/test/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzerTest.java index 3efa70b10..b514d8de2 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/MaxLengthExactValuesInStringFieldsFuzzerTest.java @@ -1,8 +1,8 @@ package com.endava.cats.fuzzer.fields; import com.endava.cats.args.FilesArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.model.FuzzingData; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.StringSchema; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzerTest.java index abf407cfc..fc510b93e 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/MaximumExactValuesInNumericFieldsFuzzerTest.java @@ -1,8 +1,8 @@ package com.endava.cats.fuzzer.fields; import com.endava.cats.args.FilesArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.model.FuzzingData; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.IntegerSchema; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzerTest.java index e1ec4d4fb..b8b6ed678 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/MinLengthExactValuesInStringFieldsFuzzerTest.java @@ -1,8 +1,8 @@ package com.endava.cats.fuzzer.fields; import com.endava.cats.args.FilesArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.model.FuzzingData; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.StringSchema; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzerTest.java index 17e8892dc..2e5897340 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/MinimumExactValuesInNumericFieldsFuzzerTest.java @@ -1,8 +1,8 @@ package com.endava.cats.fuzzer.fields; import com.endava.cats.args.FilesArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.model.FuzzingData; import io.quarkus.test.junit.QuarkusTest; import io.swagger.v3.oas.models.media.IntegerSchema; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzerTest.java index 8c2b632d6..b80737622 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeUnicodeValuesInFieldsFuzzerTest.java @@ -31,12 +31,12 @@ void shouldOverrideDefaultMethods() { void shouldGetPayloadSize() { Mockito.when(processingArguments.getLargeStringsSize()).thenReturn(20000); - Assertions.assertThat(veryLargeUnicodeValuesInFieldsFuzzer.getFieldFuzzingStrategy(null, null).get(0).getData()).hasSizeGreaterThan(20000); + Assertions.assertThat(veryLargeUnicodeValuesInFieldsFuzzer.getFieldFuzzingStrategy(null, null).get(0).getData().toString()).hasSizeGreaterThan(20000); } @Test void shouldGenerateLessThan500() { Mockito.when(processingArguments.getLargeStringsSize()).thenReturn(20); - Assertions.assertThat(veryLargeUnicodeValuesInFieldsFuzzer.getFieldFuzzingStrategy(null, null).get(0).getData()).hasSize(20 + "cats".length()); + Assertions.assertThat(veryLargeUnicodeValuesInFieldsFuzzer.getFieldFuzzingStrategy(null, null).get(0).getData().toString()).hasSize(20 + "cats".length()); } } \ No newline at end of file diff --git a/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzerTest.java index 271b21db9..d4ce388f7 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/VeryLargeValuesInFieldsFuzzerTest.java @@ -29,6 +29,6 @@ void givenANewVeryLargeStringsFuzzer_whenCreatingANewInstance_thenTheMethodsBein void shouldGetPayloadSize() { Mockito.when(processingArguments.getLargeStringsSize()).thenReturn(20000); - Assertions.assertThat(veryLargeValuesInFieldsFuzzer.getFieldFuzzingStrategy(null, null).get(0).getData()).hasSize(20000); + Assertions.assertThat(veryLargeValuesInFieldsFuzzer.getFieldFuzzingStrategy(null, null).get(0).getData().toString()).hasSize(20000); } } diff --git a/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsSanitizeValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsSanitizeValidateFuzzerTest.java index 1ea8402c9..439e18a1f 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsSanitizeValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsSanitizeValidateFuzzerTest.java @@ -43,7 +43,7 @@ void shouldProperlyOverrideSuperClassMethods() { FuzzingStrategy fuzzingStrategy = zalgoTextInStringFieldsSanitizeValidateFuzzer.getFieldFuzzingStrategy(data, "field").get(0); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.replace().name()); - Assertions.assertThat(fuzzingStrategy.getData()).contains("c̷̨̛̥̬͉̘̬̻̩͕͚̦̺̻͓̳͇̲̭̝̙̟̈́̉̐͂͒̆͂̿͌̑͐̌̇̈́̾̉̆̀̅̓͛͋̈̄͊̈̄̎̃̒͂̓̊̌̎̌̃́̅͊̏͘͘͘̕̕͘͠͝a"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("c̷̨̛̥̬͉̘̬̻̩͕͚̦̺̻͓̳͇̲̭̝̙̟̈́̉̐͂͒̆͂̿͌̑͐̌̇̈́̾̉̆̀̅̓͛͋̈̄͊̈̄̎̃̒͂̓̊̌̎̌̃́̅͊̏͘͘͘̕̕͘͠͝a"); Assertions.assertThat(zalgoTextInStringFieldsSanitizeValidateFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.TWOXX); Assertions.assertThat(zalgoTextInStringFieldsSanitizeValidateFuzzer.description()).isNotNull(); Assertions.assertThat(zalgoTextInStringFieldsSanitizeValidateFuzzer.concreteFuzzStrategy().name()).isEqualTo(FuzzingStrategy.replace().name()); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsValidateSanitizeFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsValidateSanitizeFuzzerTest.java index 3c8c838de..b4dd37dd7 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsValidateSanitizeFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/ZalgoTextInStringFieldsValidateSanitizeFuzzerTest.java @@ -41,7 +41,7 @@ void shouldProperlyOverrideSuperClassMethods() { Mockito.when(data.getRequestPropertyTypes()).thenReturn(reqTypes); FuzzingStrategy fuzzingStrategy = zalgoTextInStringFieldsValidateSanitizeFuzzer.getFieldFuzzingStrategy(data, "field").get(0); - Assertions.assertThat(fuzzingStrategy.getData()).contains("c̷̨̛̥̬͉̘̬̻̩͕͚̦̺̻͓̳͇̲̭̝̙̟̈́̉̐͂͒̆͂̿͌̑͐̌̇̈́̾̉̆̀̅̓͛͋̈̄͊̈̄̎̃̒͂̓̊̌̎̌̃́̅͊̏͘͘͘̕̕͘͠͝a̶͖̐͆͑́͆̓͗͆̏̑̈́̾͛̎̂̒̄̏̍͌͛̀́̄̓̍̐͂̀́̈́̂͐̕̕̕̚͘͠͝͠t̵̨̢̨͙̪̼͚͖̲̻̞̦̤̲̖͚̟̯͔̬̜̬͖̺͎̼̬̞̱̳͚͔͎̩̩̩̲̗̩̊̽̈́̔̀̍͒̓̂͐̾̆̐̒̄͂͒̽̾̔͊̒̀͗̿̈́͆͆̂͆̈́̋̏͊̉͌̒̏̓̑͛̉͘͜͜͜͝͝͠͠s̶"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("c̷̨̛̥̬͉̘̬̻̩͕͚̦̺̻͓̳͇̲̭̝̙̟̈́̉̐͂͒̆͂̿͌̑͐̌̇̈́̾̉̆̀̅̓͛͋̈̄͊̈̄̎̃̒͂̓̊̌̎̌̃́̅͊̏͘͘͘̕̕͘͠͝a̶͖̐͆͑́͆̓͗͆̏̑̈́̾͛̎̂̒̄̏̍͌͛̀́̄̓̍̐͂̀́̈́̂͐̕̕̕̚͘͠͝͠t̵̨̢̨͙̪̼͚͖̲̻̞̦̤̲̖͚̟̯͔̬̜̬͖̺͎̼̬̞̱̳͚͔͎̩̩̩̲̗̩̊̽̈́̔̀̍͒̓̂͐̾̆̐̒̄͂͒̽̾̔͊̒̀͗̿̈́͆͆̂͆̈́̋̏͊̉͌̒̏̓̑͛̉͘͜͜͜͝͝͠͠s̶"); Assertions.assertThat(zalgoTextInStringFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(zalgoTextInStringFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenOptionalFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(zalgoTextInStringFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenRequiredFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzerTest.java index 1f877e107..4a9511b39 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/base/BaseBoundaryFieldFuzzerTest.java @@ -57,7 +57,7 @@ void givenABaseBoundaryFuzzerWithNoDefinedBoundary_whenGettingTheFuzzingStrategy FuzzingStrategy strategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "field").get(0); Assertions.assertThat(strategy.name()).isEqualTo(FuzzingStrategy.skip().name()); - Assertions.assertThat(strategy.getData()).startsWith("No LEFT or RIGHT boundary"); + Assertions.assertThat(strategy.getData().toString()).startsWith("No LEFT or RIGHT boundary"); } @Test @@ -68,7 +68,7 @@ void givenABaseBoundaryFuzzerWithNoDefinedBoundaryAndIntegerSchema_whenGettingTh FuzzingStrategy strategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "field").get(0); Assertions.assertThat(strategy.name()).isEqualTo(FuzzingStrategy.skip().name()); - Assertions.assertThat(strategy.getData()).startsWith("Data type not matching [IntegerSchema]"); + Assertions.assertThat(strategy.getData().toString()).startsWith("Data type not matching [IntegerSchema]"); } @Test @@ -79,7 +79,7 @@ void givenABaseBoundaryFuzzerAndAFieldWithNoSchema_whenGettingTheFuzzingStrategy FuzzingStrategy strategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "field").get(0); Assertions.assertThat(strategy.name()).isEqualTo(FuzzingStrategy.skip().name()); - Assertions.assertThat(strategy.getData()).startsWith("Data type not matching"); + Assertions.assertThat(strategy.getData().toString()).startsWith("Data type not matching"); Assertions.assertThat(myBaseBoundaryFuzzer.typeOfDataSentToTheService()).startsWith("outside the boundary values"); } @@ -93,7 +93,7 @@ void shouldSkipWhenFormatNotRecognized() { FuzzingStrategy fuzzingStrategy = myBaseBoundaryFuzzer.getFieldFuzzingStrategy(data, "emailAddress").get(0); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.skip().name()); - Assertions.assertThat(fuzzingStrategy.getData()).startsWith("String format not supplied or not recognized!"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).startsWith("String format not supplied or not recognized!"); } private FuzzingData getMockFuzzingData() { diff --git a/src/test/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzerTest.java index 4cd3b1886..93d936637 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/base/BaseFieldsFuzzerTest.java @@ -3,11 +3,10 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.model.util.JsonUtils; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingResult; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; import io.quarkus.test.junit.QuarkusTest; @@ -67,7 +66,7 @@ void givenAFieldWithASkipFuzzingStrategy_whenTheFieldIsFuzzedAndNoExceptionOccur Mockito.when(data.getAllFieldsByHttpMethod()).thenReturn(fields); baseFieldsFuzzer.fuzz(data); - Mockito.verify(testCaseListener).skipTest(Mockito.any(), Mockito.eq(null)); + Mockito.verify(testCaseListener).skipTest(Mockito.any(), Mockito.eq("")); } @Test @@ -215,7 +214,7 @@ protected ResponseCodeFamily getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern @Override protected List getFieldFuzzingStrategy(FuzzingData data, String fuzzedField) { - return Collections.singletonList(FuzzingStrategy.skip()); + return Collections.singletonList(FuzzingStrategy.skip().withData("")); } @Override diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzerTest.java index e5991377f..9e6cd3565 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsTrimValidateFuzzerTest.java @@ -2,8 +2,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzerTest.java index cac45e19c..71a933e2b 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyControlCharsInFieldsValidateTrimFuzzerTest.java @@ -2,8 +2,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java index 2bb0b5e2c..3e63ebe8b 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java @@ -3,8 +3,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java index 5e0bd683c..833117f4f 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java @@ -2,8 +2,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java index a18828140..5fda21bbb 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java @@ -2,8 +2,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java index 5b93d446b..4c6f85e0b 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlySingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java @@ -2,8 +2,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzerTest.java index dd2565f0b..7686547bb 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsTrimValidateFuzzerTest.java @@ -2,8 +2,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; diff --git a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzerTest.java index d1299279c..00471502a 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/only/OnlyWhitespacesInFieldsValidateTrimFuzzerTest.java @@ -2,8 +2,8 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.args.IgnoreArguments; -import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.http.HttpMethod; +import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; @@ -53,7 +53,7 @@ void givenANewSpacesOnlyInFieldsValidateTrimFuzzer_whenCreatingANewInstance_then FuzzingStrategy fuzzingStrategy = onlyWhitespacesInFieldsValidateTrimFuzzer.getFieldFuzzingStrategy(data, "schema").get(0); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.replace().name()); - Assertions.assertThat(fuzzingStrategy.getData()).contains(" "); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains(" "); stringSchema.setMinLength(5); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/within/CommonWithinMethodsTest.java b/src/test/java/com/endava/cats/fuzzer/fields/within/CommonWithinMethodsTest.java index d3646153e..90a5da162 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/within/CommonWithinMethodsTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/within/CommonWithinMethodsTest.java @@ -48,7 +48,7 @@ void shouldInsertWithoutReplaceWhenNotMaintainSize() { List fuzzingStrategyList = CommonWithinMethods.getFuzzingStrategies(fuzzingData, "test1", List.of(YY), false); Assertions.assertThat(fuzzingStrategyList).hasSize(1); - Assertions.assertThat(fuzzingStrategyList.get(0).getData()).contains(YY).doesNotStartWith(YY).doesNotEndWith(YY).hasSize(length + YY.length()); + Assertions.assertThat(fuzzingStrategyList.get(0).getData().toString()).contains(YY).doesNotStartWith(YY).doesNotEndWith(YY).hasSize(length + YY.length()); } @Test @@ -64,7 +64,7 @@ void shouldInsertWitReplaceWhenMaintainSize() { List fuzzingStrategyList = CommonWithinMethods.getFuzzingStrategies(fuzzingData, "test1", List.of(YY), true); Assertions.assertThat(fuzzingStrategyList).hasSize(1); - Assertions.assertThat(fuzzingStrategyList.get(0).getData()).contains(YY).doesNotStartWith(YY).doesNotEndWith(YY).hasSize(length); + Assertions.assertThat(fuzzingStrategyList.get(0).getData().toString()).contains(YY).doesNotStartWith(YY).doesNotEndWith(YY).hasSize(length); } @Test diff --git a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzerTest.java index 43255df99..45f15ef7d 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsSanitizeValidateFuzzerTest.java @@ -42,7 +42,7 @@ void shouldProperlyOverrideSuperClassMethods() { FuzzingStrategy fuzzingStrategy = withinControlCharsInFieldsSanitizeValidateFuzzer.getFieldFuzzingStrategy(data, "field").get(1); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.replace().name()); - Assertions.assertThat(fuzzingStrategy.getData()).contains("\u0007"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("\u0007"); Assertions.assertThat(withinControlCharsInFieldsSanitizeValidateFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.TWOXX); Assertions.assertThat(withinControlCharsInFieldsSanitizeValidateFuzzer.description()).isNotNull(); Assertions.assertThat(withinControlCharsInFieldsSanitizeValidateFuzzer.concreteFuzzStrategy().name()).isEqualTo(FuzzingStrategy.replace().name()); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzerTest.java index f8e172c4a..c768cf75e 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinControlCharsInFieldsValidateSanitizeFuzzerTest.java @@ -44,7 +44,7 @@ void shouldProperlyOverrideSuperClassMethods() { Mockito.when(data.getRequestPropertyTypes()).thenReturn(reqTypes); FuzzingStrategy fuzzingStrategy = controlCharsWithinFieldsValidateSanitizeFuzzer.getFieldFuzzingStrategy(data, "field").get(1); - Assertions.assertThat(fuzzingStrategy.getData()).contains("\u0007"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("\u0007"); Assertions.assertThat(controlCharsWithinFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(controlCharsWithinFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenOptionalFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(controlCharsWithinFieldsValidateSanitizeFuzzer.getExpectedHttpCodeWhenRequiredFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java index 0a62eadbd..cd3835e27 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsTrimValidateFuzzerTest.java @@ -45,7 +45,7 @@ void shouldProperlyOverrideSuperClassMethods() { FuzzingStrategy fuzzingStrategy = withinMultiCodePointEmojisInFieldsTrimValidateFuzzer.getFieldFuzzingStrategy(data, "field").get(1); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.replace().name()); - Assertions.assertThat(fuzzingStrategy.getData()).contains("\uD83D\uDC68\u200D\uD83C\uDFED️"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("\uD83D\uDC68\u200D\uD83C\uDFED️"); Assertions.assertThat(withinMultiCodePointEmojisInFieldsTrimValidateFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.TWOXX); Assertions.assertThat(withinMultiCodePointEmojisInFieldsTrimValidateFuzzer.description()).isNotNull(); Assertions.assertThat(withinMultiCodePointEmojisInFieldsTrimValidateFuzzer.concreteFuzzStrategy().name()).isEqualTo(FuzzingStrategy.replace().name()); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java index 6d4c6e52e..5f2315106 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinMultiCodePointEmojisInFieldsValidateTrimFuzzerTest.java @@ -44,7 +44,7 @@ void shouldProperlyOverrideSuperClassMethods() { Mockito.when(data.getRequestPropertyTypes()).thenReturn(reqTypes); FuzzingStrategy fuzzingStrategy = withinMultiCodePointEmojisInFieldsValidateTrimFuzzer.getFieldFuzzingStrategy(data, "field").get(1); - Assertions.assertThat(fuzzingStrategy.getData()).contains("\uD83D\uDC68\u200D\uD83C\uDFED️"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("\uD83D\uDC68\u200D\uD83C\uDFED️"); Assertions.assertThat(withinMultiCodePointEmojisInFieldsValidateTrimFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(withinMultiCodePointEmojisInFieldsValidateTrimFuzzer.getExpectedHttpCodeWhenOptionalFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(withinMultiCodePointEmojisInFieldsValidateTrimFuzzer.getExpectedHttpCodeWhenRequiredFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java index 1a24b8eed..b3d853350 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsTrimValidateFuzzerTest.java @@ -45,7 +45,7 @@ void shouldProperlyOverrideSuperClassMethods() { FuzzingStrategy fuzzingStrategy = withinSingleCodePointEmojisInFieldsTrimValidateFuzzer.getFieldFuzzingStrategy(data, "field").get(1); Assertions.assertThat(fuzzingStrategy.name()).isEqualTo(FuzzingStrategy.replace().name()); - Assertions.assertThat(fuzzingStrategy.getData()).contains("\uD83D\uDC80"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("\uD83D\uDC80"); Assertions.assertThat(withinSingleCodePointEmojisInFieldsTrimValidateFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.TWOXX); Assertions.assertThat(withinSingleCodePointEmojisInFieldsTrimValidateFuzzer.description()).isNotNull(); Assertions.assertThat(withinSingleCodePointEmojisInFieldsTrimValidateFuzzer.concreteFuzzStrategy().name()).isEqualTo(FuzzingStrategy.replace().name()); diff --git a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java index 84785fb5f..08a3c5321 100644 --- a/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/fields/within/WithinSingleCodePointEmojisInFieldsValidateTrimFuzzerTest.java @@ -44,7 +44,7 @@ void shouldProperlyOverrideSuperClassMethods() { Mockito.when(data.getRequestPropertyTypes()).thenReturn(reqTypes); FuzzingStrategy fuzzingStrategy = withinSingleCodePointEmojisInFieldsValidateTrimFuzzer.getFieldFuzzingStrategy(data, "field").get(1); - Assertions.assertThat(fuzzingStrategy.getData()).contains("\uD83D\uDC80"); + Assertions.assertThat(fuzzingStrategy.getData().toString()).contains("\uD83D\uDC80"); Assertions.assertThat(withinSingleCodePointEmojisInFieldsValidateTrimFuzzer.getExpectedHttpCodeWhenFuzzedValueNotMatchesPattern()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(withinSingleCodePointEmojisInFieldsValidateTrimFuzzer.getExpectedHttpCodeWhenOptionalFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); Assertions.assertThat(withinSingleCodePointEmojisInFieldsValidateTrimFuzzer.getExpectedHttpCodeWhenRequiredFieldsAreFuzzed()).isEqualTo(ResponseCodeFamily.FOURXX); diff --git a/src/test/java/com/endava/cats/fuzzer/headers/CheckSecurityHeadersFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/CheckSecurityHeadersFuzzerTest.java index a1d29602e..d64025d2c 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/CheckSecurityHeadersFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/CheckSecurityHeadersFuzzerTest.java @@ -2,10 +2,10 @@ import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsHeader; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/headers/DuplicateHeaderFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/DuplicateHeaderFuzzerTest.java index be96e4b1a..3ab532565 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/DuplicateHeaderFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/DuplicateHeaderFuzzerTest.java @@ -2,10 +2,10 @@ import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsHeader; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/headers/ExtraHeaderFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/ExtraHeaderFuzzerTest.java index a29e88c19..437ba43e2 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/ExtraHeaderFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/ExtraHeaderFuzzerTest.java @@ -2,10 +2,10 @@ import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsHeader; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/headers/RemoveHeadersFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/RemoveHeadersFuzzerTest.java index 255711f76..35373108c 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/RemoveHeadersFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/RemoveHeadersFuzzerTest.java @@ -2,10 +2,10 @@ import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsHeader; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/headers/UnsupportedContentTypesHeadersFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/UnsupportedContentTypesHeadersFuzzerTest.java index abfca9635..ae8b632ea 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/UnsupportedContentTypesHeadersFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/UnsupportedContentTypesHeadersFuzzerTest.java @@ -2,9 +2,9 @@ import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsHeader; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzerTest.java index 9300f66f1..a6becaa06 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeUnicodeValuesInHeadersFuzzerTest.java @@ -37,6 +37,6 @@ void givenANewLargeValuesInHeadersFuzzer_whenCreatingANewInstance_thenTheMethods @Test void shouldGetPayloadSize() { Mockito.when(processingArguments.getLargeStringsSize()).thenReturn(20); - Assertions.assertThat(veryLargeUnicodeValuesInHeadersFuzzer.fuzzStrategy().get(0).getData()).hasSize(20 + "cats".length()); + Assertions.assertThat(veryLargeUnicodeValuesInHeadersFuzzer.fuzzStrategy().get(0).getData().toString()).hasSize(20 + "cats".length()); } } \ No newline at end of file diff --git a/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzerTest.java index c478e0336..df42f499f 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/VeryLargeValuesInHeadersFuzzerTest.java @@ -39,6 +39,6 @@ void shouldGetPayloadSize() { Mockito.when(processingArguments.getLargeStringsSize()).thenReturn(20000); Assertions.assertThat(veryLargeValuesInHeadersFuzzer.fuzzStrategy()).hasSize(1); - Assertions.assertThat(veryLargeValuesInHeadersFuzzer.fuzzStrategy().get(0).getData()).hasSize(20000); + Assertions.assertThat(veryLargeValuesInHeadersFuzzer.fuzzStrategy().get(0).getData().toString()).hasSize(20000); } } diff --git a/src/test/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzerTest.java index aef4a1702..4fc0c87ec 100644 --- a/src/test/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/headers/base/BaseHeadersFuzzerTest.java @@ -2,11 +2,11 @@ import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsHeader; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; import com.endava.cats.model.FuzzingStrategy; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import com.google.common.collect.Sets; import io.quarkus.test.junit.QuarkusTest; diff --git a/src/test/java/com/endava/cats/fuzzer/http/BypassAuthenticationFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/http/BypassAuthenticationFuzzerTest.java index c7c97fd08..4f4a85c85 100644 --- a/src/test/java/com/endava/cats/fuzzer/http/BypassAuthenticationFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/http/BypassAuthenticationFuzzerTest.java @@ -3,10 +3,10 @@ import com.endava.cats.args.FilesArguments; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsHeader; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import com.endava.cats.util.CatsUtil; import io.quarkus.test.junit.QuarkusTest; diff --git a/src/test/java/com/endava/cats/fuzzer/http/DummyRequestFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/http/DummyRequestFuzzerTest.java index a1fbad44b..dba9f5ea5 100644 --- a/src/test/java/com/endava/cats/fuzzer/http/DummyRequestFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/http/DummyRequestFuzzerTest.java @@ -3,9 +3,9 @@ import com.endava.cats.http.HttpMethod; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/http/HappyFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/http/HappyFuzzerTest.java index 6dd1cad52..9e562bedd 100644 --- a/src/test/java/com/endava/cats/fuzzer/http/HappyFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/http/HappyFuzzerTest.java @@ -3,9 +3,9 @@ import com.endava.cats.http.HttpMethod; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/http/HttpMethodsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/http/HttpMethodsFuzzerTest.java index e9fa185c1..2e6fb2705 100644 --- a/src/test/java/com/endava/cats/fuzzer/http/HttpMethodsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/http/HttpMethodsFuzzerTest.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.http; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/http/MalformedJsonFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/http/MalformedJsonFuzzerTest.java index b1921b859..47711a903 100644 --- a/src/test/java/com/endava/cats/fuzzer/http/MalformedJsonFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/http/MalformedJsonFuzzerTest.java @@ -3,9 +3,9 @@ import com.endava.cats.http.HttpMethod; import com.endava.cats.http.ResponseCodeFamily; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/fuzzer/http/NonRestHttpMethodsFuzzerTest.java b/src/test/java/com/endava/cats/fuzzer/http/NonRestHttpMethodsFuzzerTest.java index 193d0d048..e41d869a1 100644 --- a/src/test/java/com/endava/cats/fuzzer/http/NonRestHttpMethodsFuzzerTest.java +++ b/src/test/java/com/endava/cats/fuzzer/http/NonRestHttpMethodsFuzzerTest.java @@ -1,9 +1,9 @@ package com.endava.cats.fuzzer.http; import com.endava.cats.io.ServiceCaller; -import com.endava.cats.report.TestCaseExporter; import com.endava.cats.model.CatsResponse; import com.endava.cats.model.FuzzingData; +import com.endava.cats.report.TestCaseExporter; import com.endava.cats.report.TestCaseListener; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.mockito.InjectSpy; diff --git a/src/test/java/com/endava/cats/generator/simple/NumberGeneratorTest.java b/src/test/java/com/endava/cats/generator/simple/NumberGeneratorTest.java index f3713f65e..a55343708 100644 --- a/src/test/java/com/endava/cats/generator/simple/NumberGeneratorTest.java +++ b/src/test/java/com/endava/cats/generator/simple/NumberGeneratorTest.java @@ -17,18 +17,18 @@ void givenAnIntegerSchemaWithDefinedMinimum_whenGeneratingALeftBoundaryInteger_t Schema schema = new IntegerSchema(); long minimum = 2000; schema.setMinimum(BigDecimal.valueOf(minimum)); - String leftBoundaryValue = NumberGenerator.generateLeftBoundaryIntegerValue(schema); + Number leftBoundaryValue = NumberGenerator.generateLeftBoundaryIntegerValue(schema); - String expected = String.valueOf(minimum - NumberGenerator.TEN_THOUSANDS); + Number expected = new BigDecimal(minimum - NumberGenerator.TEN_THOUSANDS); Assertions.assertThat(leftBoundaryValue).isEqualTo(expected); } @Test void givenAnIntegerSchemaWithoutDefinedMinimum_whenGeneratingLeftBoundaryInteger_thenTheValueIsDefault() { Schema schema = new IntegerSchema(); - String leftBoundaryValue = NumberGenerator.generateLeftBoundaryIntegerValue(schema); + Number leftBoundaryValue = NumberGenerator.generateLeftBoundaryIntegerValue(schema); - Assertions.assertThat(leftBoundaryValue).isEqualTo(String.valueOf(new BigDecimal(Long.MIN_VALUE).subtract(BigDecimal.TEN))); + Assertions.assertThat(leftBoundaryValue).isEqualTo(new BigDecimal(Long.MIN_VALUE).subtract(BigDecimal.TEN)); } @Test @@ -36,18 +36,18 @@ void givenAnIntegerSchemaWithDefinedMaximum_whenGeneratingARightBoundaryInteger_ Schema schema = new IntegerSchema(); long maximum = 2000; schema.setMaximum(BigDecimal.valueOf(maximum)); - String leftBoundaryValue = NumberGenerator.generateRightBoundaryIntegerValue(schema); + Number leftBoundaryValue = NumberGenerator.generateRightBoundaryIntegerValue(schema); - String expected = String.valueOf(maximum + NumberGenerator.TEN_THOUSANDS); + Number expected = new BigDecimal(maximum + NumberGenerator.TEN_THOUSANDS); Assertions.assertThat(leftBoundaryValue).isEqualTo(expected); } @Test void givenAnIntegerSchemaWithoutDefinedMaximum_whenGeneratingRightBoundaryInteger_thenTheValueIsDefault() { Schema schema = new IntegerSchema(); - String leftBoundaryValue = NumberGenerator.generateRightBoundaryIntegerValue(schema); + Number leftBoundaryValue = NumberGenerator.generateRightBoundaryIntegerValue(schema); - Assertions.assertThat(leftBoundaryValue).isEqualTo(String.valueOf(new BigDecimal(Long.MAX_VALUE).add(BigDecimal.TEN))); + Assertions.assertThat(leftBoundaryValue).isEqualTo(new BigDecimal(Long.MAX_VALUE).add(BigDecimal.TEN)); } @Test @@ -55,140 +55,140 @@ void givenANumberSchemaWithDefinedMinimum_whenGeneratingALeftBoundaryDecimal_the Schema schema = new NumberSchema(); BigDecimal minimum = BigDecimal.valueOf(2000); schema.setMinimum(minimum); - String leftBoundaryValue = NumberGenerator.generateLeftBoundaryDecimalValue(schema); + Number leftBoundaryValue = NumberGenerator.generateLeftBoundaryDecimalValue(schema); - String expected = String.valueOf(minimum.subtract(NumberGenerator.DECIMAL_CONSTANT)); + Number expected = minimum.subtract(NumberGenerator.DECIMAL_CONSTANT); Assertions.assertThat(leftBoundaryValue).isEqualTo(expected); } @Test void givenAnNumberSchemaWithoutDefinedMinimum_whenGeneratingLeftBoundaryDecimal_thenTheValueIsDefault() { Schema schema = new NumberSchema(); - String leftBoundaryValue = NumberGenerator.generateLeftBoundaryDecimalValue(schema); + Number leftBoundaryValue = NumberGenerator.generateLeftBoundaryDecimalValue(schema); - Assertions.assertThat(leftBoundaryValue).isEqualTo(String.valueOf(new BigDecimal(Long.MIN_VALUE).subtract(BigDecimal.TEN))); + Assertions.assertThat(leftBoundaryValue).isEqualTo(new BigDecimal(Long.MIN_VALUE).subtract(BigDecimal.TEN)); } @Test void givenANumberSchemaWithDefinedMaximum_whenGeneratingARightBoundaryDecimal_thenTheValueIsHigherThanTheMaximum() { Schema schema = new NumberSchema(); schema.setMaximum(BigDecimal.valueOf(2000)); - String leftBoundaryValue = NumberGenerator.generateRightBoundaryDecimalValue(schema); + Number leftBoundaryValue = NumberGenerator.generateRightBoundaryDecimalValue(schema); - String expected = String.valueOf(BigDecimal.valueOf(2000).add(NumberGenerator.DECIMAL_CONSTANT)); + Number expected = BigDecimal.valueOf(2000).add(NumberGenerator.DECIMAL_CONSTANT); Assertions.assertThat(leftBoundaryValue).isEqualTo(expected); } @Test void givenANumberSchemaWithoutDefinedMaximum_whenGeneratingRightBoundaryDecimal_thenTheValueIsDefault() { Schema schema = new NumberSchema(); - String leftBoundaryValue = NumberGenerator.generateRightBoundaryDecimalValue(schema); + Number leftBoundaryValue = NumberGenerator.generateRightBoundaryDecimalValue(schema); - Assertions.assertThat(leftBoundaryValue).isEqualTo(String.valueOf(new BigDecimal(Long.MAX_VALUE).add(BigDecimal.TEN))); + Assertions.assertThat(leftBoundaryValue).isEqualTo(new BigDecimal(Long.MAX_VALUE).add(BigDecimal.TEN)); } @Test void givenANumberSchemaOfTypeInt32_whenGeneratingAnExtremeNegativeIntegerValue_thenLongMinValueIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("int32"); - String extremeNegative = NumberGenerator.getExtremeNegativeIntegerValue(schema); + Number extremeNegative = NumberGenerator.getExtremeNegativeIntegerValue(schema); - Assertions.assertThat(extremeNegative).isEqualTo(String.valueOf(Long.MIN_VALUE)); + Assertions.assertThat(extremeNegative).isEqualTo(Long.MIN_VALUE); } @Test void givenANumberSchema_whenGeneratingAnExtremeNegativeIntegerValue_thenLongMinValueIsReturned() { Schema schema = new NumberSchema(); - String extremeNegative = NumberGenerator.getExtremeNegativeIntegerValue(schema); + Number extremeNegative = NumberGenerator.getExtremeNegativeIntegerValue(schema); - Assertions.assertThat(extremeNegative).isEqualTo(String.valueOf(Long.MIN_VALUE)); + Assertions.assertThat(extremeNegative).isEqualTo(Long.MIN_VALUE); } @Test void givenANumberSchemaOfTypeInt64_whenGeneratingAnExtremeNegativeValue_thenTheMostNegativeConstantIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("int64"); - String extremeNegative = NumberGenerator.getExtremeNegativeIntegerValue(schema); + Number extremeNegative = NumberGenerator.getExtremeNegativeIntegerValue(schema); - Assertions.assertThat(extremeNegative).isEqualTo(String.valueOf(NumberGenerator.MOST_NEGATIVE_INTEGER)); + Assertions.assertThat(extremeNegative).isEqualTo(NumberGenerator.MOST_NEGATIVE_INTEGER); } @Test void givenANumberSchemaOfTypeInt32_whenGeneratingAnExtremePositiveIntegerValue_thenLongMaxValueIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("int32"); - String extremePositive = NumberGenerator.getExtremePositiveIntegerValue(schema); + Number extremePositive = NumberGenerator.getExtremePositiveIntegerValue(schema); - Assertions.assertThat(extremePositive).isEqualTo(String.valueOf(Long.MAX_VALUE)); + Assertions.assertThat(extremePositive).isEqualTo(Long.MAX_VALUE); } @Test void givenANumberSchema_whenGeneratingAnExtremePositiveIntegerValue_thenLongMaxValueIsReturned() { Schema schema = new NumberSchema(); - String extremePositive = NumberGenerator.getExtremePositiveIntegerValue(schema); + Number extremePositive = NumberGenerator.getExtremePositiveIntegerValue(schema); - Assertions.assertThat(extremePositive).isEqualTo(String.valueOf(Long.MAX_VALUE)); + Assertions.assertThat(extremePositive).isEqualTo(Long.MAX_VALUE); } @Test void givenANumberSchemaOfTypeInt64_whenGeneratingAnExtremePositiveValue_thenTheMostPositiveConstantIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("int64"); - String extremePositive = NumberGenerator.getExtremePositiveIntegerValue(schema); + Number extremePositive = NumberGenerator.getExtremePositiveIntegerValue(schema); - Assertions.assertThat(extremePositive).isEqualTo(String.valueOf(NumberGenerator.MOST_POSITIVE_INTEGER)); + Assertions.assertThat(extremePositive).isEqualTo(NumberGenerator.MOST_POSITIVE_INTEGER); } @Test void givenANumberSchemaOfTypeFloat_whenGeneratingAnExtremePositiveDecimalValue_thenTheFloatMaxValueIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("float"); - String extremePositive = NumberGenerator.getExtremePositiveDecimalValue(schema); + Number extremePositive = NumberGenerator.getExtremePositiveDecimalValue(schema); - Assertions.assertThat(extremePositive).isEqualTo(String.valueOf(Float.MAX_VALUE)); + Assertions.assertThat(extremePositive).isEqualTo(Float.MAX_VALUE); } @Test void givenANumberSchemaWithDefaultFormat_whenGeneratingAnExtremePositiveDecimalValue_thenTheMostPositiveDecimalConstantIsReturned() { Schema schema = new NumberSchema(); - String extremePositive = NumberGenerator.getExtremePositiveDecimalValue(schema); + Number extremePositive = NumberGenerator.getExtremePositiveDecimalValue(schema); - Assertions.assertThat(extremePositive).isEqualTo(String.valueOf(NumberGenerator.MOST_POSITIVE_DECIMAL)); + Assertions.assertThat(extremePositive).isEqualTo(NumberGenerator.MOST_POSITIVE_DECIMAL); } @Test void givenANumberSchemaOfTypeDouble_whenGeneratingAnExtremePositiveDecimalValue_thenDoubleMaxValueIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("double"); - String extremePositive = NumberGenerator.getExtremePositiveDecimalValue(schema); + Number extremePositive = NumberGenerator.getExtremePositiveDecimalValue(schema); - Assertions.assertThat(extremePositive).isEqualTo(String.valueOf(Double.MAX_VALUE)); + Assertions.assertThat(extremePositive).isEqualTo(Double.MAX_VALUE); } @Test void givenANumberSchemaOfTypeFloat_whenGeneratingAnExtremeNegativeDecimalValue_thenTheMinusFloatMaxValueIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("float"); - String extremeNegative = NumberGenerator.getExtremeNegativeDecimalValue(schema); + Number extremeNegative = NumberGenerator.getExtremeNegativeDecimalValue(schema); - Assertions.assertThat(extremeNegative).isEqualTo(String.valueOf(-Float.MAX_VALUE)); + Assertions.assertThat(extremeNegative).isEqualTo(-Float.MAX_VALUE); } @Test void givenANumberSchemaWithDefaultFormat_whenGeneratingAnExtremeNegativeDecimalValue_thenTheMostNegativeDecimalConstantIsReturned() { Schema schema = new NumberSchema(); - String extremeNegative = NumberGenerator.getExtremeNegativeDecimalValue(schema); + Number extremeNegative = NumberGenerator.getExtremeNegativeDecimalValue(schema); - Assertions.assertThat(extremeNegative).isEqualTo(String.valueOf(NumberGenerator.MOST_NEGATIVE_DECIMAL)); + Assertions.assertThat(extremeNegative).isEqualTo(NumberGenerator.MOST_NEGATIVE_DECIMAL); } @Test void givenANumberSchemaOfTypeDouble_whenGeneratingAnExtremeNegativeDecimalValue_thenMinusDoubleMaxValueIsReturned() { Schema schema = new NumberSchema(); schema.setFormat("double"); - String extremeNegative = NumberGenerator.getExtremeNegativeDecimalValue(schema); + Number extremeNegative = NumberGenerator.getExtremeNegativeDecimalValue(schema); - Assertions.assertThat(extremeNegative).isEqualTo(String.valueOf(-Double.MAX_VALUE)); + Assertions.assertThat(extremeNegative).isEqualTo(-Double.MAX_VALUE); } @Test @@ -197,7 +197,7 @@ void givenANumberSchema_whenGeneratingARandomDecimalValue_thenAProperValueIsRetu BigDecimal minimum = new BigDecimal(10); schema.setMinimum(minimum); - BigDecimal generated = new BigDecimal(NumberGenerator.generateDecimalValue(schema)); + BigDecimal generated = new BigDecimal(NumberGenerator.generateDecimalValue(schema).toString()); Assertions.assertThat(generated.doubleValue() > minimum.doubleValue() && generated.doubleValue() < minimum.doubleValue() + 1).isTrue(); } diff --git a/src/test/java/com/endava/cats/model/FuzzingStrategyTest.java b/src/test/java/com/endava/cats/model/FuzzingStrategyTest.java index f32fee726..04b0de23c 100644 --- a/src/test/java/com/endava/cats/model/FuzzingStrategyTest.java +++ b/src/test/java/com/endava/cats/model/FuzzingStrategyTest.java @@ -27,7 +27,7 @@ void givenTheFuzzingStrategyClass_whenCallingTheStaticCreateMethods_thenProperIn @ParameterizedTest @CsvSource({"' '", "'\t'"}) void givenANullString_whenMergingTheFuzzingWithAnotherString_thenTheReplaceFuzzingStrategyIsApplied(String space) { - String result = FuzzingStrategy.mergeFuzzing(String.valueOf(space), "air"); + Object result = FuzzingStrategy.mergeFuzzing(String.valueOf(space), "air"); Assertions.assertThat(result).isEqualTo(String.valueOf(space)); } @@ -35,7 +35,7 @@ void givenANullString_whenMergingTheFuzzingWithAnotherString_thenTheReplaceFuzzi @ParameterizedTest @CsvSource({"' '", "'\t'"}) void givenASpacedPrefixedString_whenMergingTheFuzzingWithAnotherString_thenThePrefixFuzzingStrategyIsApplied(String space) { - String result = FuzzingStrategy.mergeFuzzing(space + space + "test", "air"); + Object result = FuzzingStrategy.mergeFuzzing(space + space + "test", "air"); Assertions.assertThat(result).isEqualTo(space + space + "air"); } @@ -43,7 +43,7 @@ void givenASpacedPrefixedString_whenMergingTheFuzzingWithAnotherString_thenThePr @ParameterizedTest @CsvSource({"' '", "'\t'"}) void givenASpaceTrailingString_whenMergingTheFuzzingWithAnotherString_thenTheTrailFuzzingStrategyIsApplied(String space) { - String result = FuzzingStrategy.mergeFuzzing("test" + space + space, "air"); + Object result = FuzzingStrategy.mergeFuzzing("test" + space + space, "air"); Assertions.assertThat(result).isEqualTo("air" + space + space); } @@ -51,14 +51,14 @@ void givenASpaceTrailingString_whenMergingTheFuzzingWithAnotherString_thenTheTra @ParameterizedTest @CsvSource({"' '", "'\t'"}) void givenAnEmptyString_whenMergingTheFuzzingWithAnotherString_thenTheReplaceFuzzingStrategyIsApplied(String space) { - String result = FuzzingStrategy.mergeFuzzing("replaced", "air"); + Object result = FuzzingStrategy.mergeFuzzing("replaced", "air"); Assertions.assertThat(result).isEqualTo("replaced"); } @Test void givenAStringWithNoSpaces_whenMergingTheFuzzingWithAnotherString_thenTheSuppliedValueIsUnchanged() { - String result = FuzzingStrategy.mergeFuzzing("test", "air"); + Object result = FuzzingStrategy.mergeFuzzing("test", "air"); Assertions.assertThat(result).isEqualTo("test"); } @@ -109,26 +109,26 @@ void shouldReturnNameOnlyWhenDataIsNull() { @ParameterizedTest @CsvSource({"'\u2001'", "'\u0001'"}) void shouldMatchUnicodeWhitespaceAndPrefix(char c) { - String result = FuzzingStrategy.mergeFuzzing(c + "test", "air"); + Object result = FuzzingStrategy.mergeFuzzing(c + "test", "air"); Assertions.assertThat(result).isEqualTo(c + "air"); } @ParameterizedTest @CsvSource({"'\u2001'", "'\u0001'"}) void shouldMatchUnicodeWhitespaceAndTrail(char c) { - String result = FuzzingStrategy.mergeFuzzing("test" + c, "air"); + Object result = FuzzingStrategy.mergeFuzzing("test" + c, "air"); Assertions.assertThat(result).isEqualTo("air" + c); } @Test void shouldInsertInSuppliedValue() { - String result = FuzzingStrategy.mergeFuzzing("te\uD83E\uDD76st", "air"); + Object result = FuzzingStrategy.mergeFuzzing("te\uD83E\uDD76st", "air"); Assertions.assertThat(result).isEqualTo("a\uD83E\uDD76ir"); } @Test void shouldReplaceWhenLargeString() { - String result = FuzzingStrategy.mergeFuzzing("caTTTTTTTTts", "air"); + Object result = FuzzingStrategy.mergeFuzzing("caTTTTTTTTts", "air"); Assertions.assertThat(result).isEqualTo("caTTTTTTTTts"); }