Skip to content

Commit 65a5e43

Browse files
Invert flag name and logic
1 parent 9910ba2 commit 65a5e43

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

core-tests/e2e-tests/spring/spring-rest-bb/src/test/kotlin/org/evomaster/e2etests/spring/rest/bb/jsonpatch/BBJsonPatchTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class BBJsonPatchTest : SpringTestBase() {
8686
)
8787

8888
runBlackBoxEM(OutputFormat.KOTLIN_JUNIT_5, "BBJsonPatchEM_NoSupport", 1000, 3, false) { args ->
89-
setOption(args, "enableJsonPatchGeneSupport", "false")
89+
setOption(args, "disableJsonPatchSupport", "true")
9090

9191
val solution = initAndRun(args)
9292
assertTrue(solution.individuals.size >= 1)
@@ -100,7 +100,7 @@ class BBJsonPatchTest : SpringTestBase() {
100100

101101
assertFalse(
102102
CoveredTargets.areCovered(specificOpTargets),
103-
"Without enableJsonPatchGeneSupport, EvoMaster should NOT cover all JSON Patch operation targets"
103+
"With disableJsonPatchSupport=true, EvoMaster should NOT cover all JSON Patch operation targets"
104104
)
105105
}
106106
}

core-tests/e2e-tests/spring/spring-rest-bb/src/test/kotlin/org/evomaster/e2etests/spring/rest/bb/xml/BBXMLTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class BBXMLTest : SpringTestBase() {
7474
@Test
7575
fun testBlackBoxWithoutXmlBodySupport() {
7676
// These targets require a well-formed XML body to reach a 200 response.
77-
// With enableXmlBodyGeneSupport=false, EvoMaster falls back to generic field
77+
// With disableXMLSupport=true, EvoMaster falls back to generic field
7878
// naming (schema ref name or 'body') instead of the actual JAXB element names,
7979
// so Spring's XML deserializer receives structurally wrong documents and returns
8080
// 400 for most requests → the 200-branch targets stay uncovered.
@@ -90,7 +90,7 @@ class BBXMLTest : SpringTestBase() {
9090
)
9191

9292
runBlackBoxEM(OutputFormat.KOTLIN_JUNIT_5, "BBXmlEM_NoSupport", 1000, 3, false) { args ->
93-
setOption(args, "enableXmlBodyGeneSupport", "false")
93+
setOption(args, "disableXMLSupport", "true")
9494

9595
val solution = initAndRun(args)
9696
assertTrue(solution.individuals.size >= 1)
@@ -104,7 +104,7 @@ class BBXMLTest : SpringTestBase() {
104104

105105
assertFalse(
106106
CoveredTargets.areCovered(xmlBodyTargets),
107-
"Without enableXmlBodyGeneSupport, EvoMaster should NOT cover all XML body targets"
107+
"With disableXMLSupport=true, EvoMaster should NOT cover all XML body targets"
108108
)
109109
}
110110
}

core/src/main/kotlin/org/evomaster/core/EMConfig.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,14 +1373,14 @@ class EMConfig {
13731373
var dtoForRequestPayload = false
13741374

13751375
@Experimental
1376-
@Cfg("Enable JSON Patch (RFC 6902) gene support when the request Content-Type is 'application/json-patch+json'." +
1377-
" When false, such endpoints are treated as regular JSON bodies, reproducing the behavior before this feature was introduced.")
1378-
var enableJsonPatchGeneSupport = true
1376+
@Cfg("Disable JSON Patch (RFC 6902) gene support when the request Content-Type is 'application/json-patch+json'." +
1377+
" When true, such endpoints are treated as regular JSON bodies, reproducing the behavior before this feature was introduced.")
1378+
var disableJsonPatchSupport = false
13791379

13801380
@Experimental
1381-
@Cfg("Enable XML-aware field naming for body genes when the request Content-Type is XML." +
1382-
" When false, body gene names fall back to the pre-feature behavior (schema ref name or 'body').")
1383-
var enableXmlBodyGeneSupport = true
1381+
@Cfg("Disable XML-aware field naming for body genes when the request Content-Type is XML." +
1382+
" When true, body gene names fall back to the pre-feature behavior (schema ref name or 'body').")
1383+
var disableXMLSupport = false
13841384

13851385
@Important(6.0)
13861386
@Cfg("Host name or IP address of where the SUT EvoMaster Controller Driver is listening on." +

core/src/main/kotlin/org/evomaster/core/problem/rest/builder/RestActionBuilderV3.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ object RestActionBuilderV3 {
116116

117117
val inferFormatFromNames: Boolean = true,
118118

119-
val enableJsonPatchGeneSupport: Boolean = true,
119+
val disableJsonPatchSupport: Boolean = false,
120120

121-
val enableXmlBodyGeneSupport: Boolean = true,
121+
val disableXMLSupport: Boolean = false,
122122
){
123123
constructor(config: EMConfig): this(
124124
enableConstraintHandling = config.enableSchemaConstraintHandling,
@@ -128,8 +128,8 @@ object RestActionBuilderV3 {
128128
usingWhiteBox = !config.blackBox,
129129
enableAdvancedFormats = config.enableAdvancedFormats,
130130
inferFormatFromNames = config.inferFormatFromNames,
131-
enableJsonPatchGeneSupport = config.enableJsonPatchGeneSupport,
132-
enableXmlBodyGeneSupport = config.enableXmlBodyGeneSupport,
131+
disableJsonPatchSupport = config.disableJsonPatchSupport,
132+
disableXMLSupport = config.disableXMLSupport,
133133
)
134134

135135
init {
@@ -754,7 +754,7 @@ object RestActionBuilderV3 {
754754
listOf()
755755
}
756756

757-
val isJsonPatch = options.enableJsonPatchGeneSupport &&
757+
val isJsonPatch = !options.disableJsonPatchSupport &&
758758
verb == HttpVerb.PATCH && bodies.keys.any { it.contains("json-patch") }
759759

760760
val name: String
@@ -781,7 +781,7 @@ object RestActionBuilderV3 {
781781
}
782782
gene = JsonPatchDocumentGene(name, resourceGene)
783783
} else {
784-
if (options.enableXmlBodyGeneSupport) {
784+
if (!options.disableXMLSupport) {
785785
// $ref schemas do not carry XML metadata; resolving the reference is required to obtain the correct XML element name from the target schema
786786
val deref = obj.schema.`$ref`?.let { ref -> SchemaUtils.getReferenceSchema(schemaHolder, currentSchema, ref, messages) } ?: obj.schema
787787
name = deref?.xml?.name ?: deref?.`$ref`?.substringAfterLast("/") ?: "body"

docs/options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,11 @@ There are 3 types of options:
287287
|`enableAdvancedFormats`| __Boolean__. Whether to enable the handling of new type formats in OpenAPI schemas, e.g., the ones introduced in 3.1.0. *Default value*: `false`.|
288288
|`enableCustomizedMethodForMockObjectHandling`| __Boolean__. Whether to apply customized method (i.e., implement 'customizeMockingRPCExternalService' for external services or 'customizeMockingDatabase' for database) to handle mock object. *Default value*: `false`.|
289289
|`enableCustomizedMethodForScheduleTaskHandling`| __Boolean__. Whether to apply customized method (i.e., implement 'customizeScheduleTaskInvocation' for invoking schedule task) to invoke schedule task. *Default value*: `false`.|
290-
|`enableJsonPatchGeneSupport`| __Boolean__. Enable JSON Patch (RFC 6902) gene support when the request Content-Type is 'application/json-patch+json'. When false, such endpoints are treated as regular JSON bodies, reproducing the behavior before this feature was introduced. *Default value*: `true`.|
290+
|`disableJsonPatchSupport`| __Boolean__. Disable JSON Patch (RFC 6902) gene support when the request Content-Type is 'application/json-patch+json'. When true, such endpoints are treated as regular JSON bodies, reproducing the behavior before this feature was introduced. *Default value*: `false`.|
291291
|`enableRPCCustomizedTestOutput`| __Boolean__. Whether to enable customized RPC Test output if 'customizeRPCTestOutput' is implemented. *Default value*: `false`.|
292292
|`enableStaticFlakyInference`| __Boolean__. Specify whether to infer potential flakiness statically from response values, such as timestamps, UUIDs, hashes and runtime-specific messages. *Depends on*: `handleFlakiness=true`. *Default value*: `true`.|
293293
|`enableWriteSnapshotTests`| __Boolean__. Enable to print snapshots of the generated tests during the search in an interval defined in snapshotsInterval. *Default value*: `false`.|
294-
|`enableXmlBodyGeneSupport`| __Boolean__. Enable XML-aware field naming for body genes when the request Content-Type is XML. When false, body gene names fall back to the pre-feature behavior (schema ref name or 'body'). *Default value*: `true`.|
294+
|`disableXMLSupport`| __Boolean__. Disable XML-aware field naming for body genes when the request Content-Type is XML. When true, body gene names fall back to the pre-feature behavior (schema ref name or 'body'). *Default value*: `false`.|
295295
|`execNumForDetectFlakiness`| __Int__. Specify the number of re-executions for detecting flakiness in tests. Set to 0 to disable re-execution based flakiness detection. *Constraints*: `min=0.0`. *Depends on*: `handleFlakiness=true`. *Default value*: `1`.|
296296
|`executiveSummary`| __Boolean__. Generate an executive summary, containing an example of each category of potential faults found.NOTE: This option is only meaningful when used in conjunction with test suite splitting. *Default value*: `false`.|
297297
|`expectationsActive`| __Boolean__. Enable Expectation Generation. If enabled, expectations will be generated. A variable called expectationsMasterSwitch is added to the test suite, with a default value of false. If set to true, an expectation that fails will cause the test case containing it to fail. *Default value*: `false`.|

0 commit comments

Comments
 (0)