Skip to content

Commit 3cbcce0

Browse files
committed
add tests observed in catwatch
1 parent 1883b83 commit 3cbcce0

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

core/src/test/kotlin/org/evomaster/core/output/TestCaseWriterTest.kt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,41 @@ class TestCaseWriterTest : WriterTestBase(){
106106
}
107107

108108

109+
@Test
110+
fun testTextAssertionWithHtmlEntityUsesStableFragment() {
111+
val format = OutputFormat.JAVA_JUNIT_4
112+
val writer = RestTestCaseWriter(getConfig(format), PartialOracles())
113+
val lines = Lines(format)
114+
115+
writer.handleTextPlainTextAssertion(
116+
"Unable to obtain a new access token for resource 'null'.", // observed in the catwatch
117+
null,
118+
lines,
119+
null
120+
)
121+
122+
assertTrue(lines.toString().contains("containsString(\"Unable to obtain a new access token for resource\")"))
123+
assertFalse(lines.toString().contains("&#39"))
124+
}
125+
126+
@Test
127+
fun testJsonStringAssertionWithHtmlEntityUsesStableFragment() {
128+
val format = OutputFormat.JAVA_JUNIT_4
129+
val writer = RestTestCaseWriter(getConfig(format), PartialOracles())
130+
val lines = Lines(format)
131+
132+
writer.handleJsonStringAssertion(
133+
"{\"message\":\"Unable to obtain a new access token for resource 'null'.\"}",
134+
null,
135+
lines,
136+
null,
137+
false
138+
)
139+
140+
assertTrue(lines.toString().contains("containsString(\"Unable to obtain a new access token for resource\")"))
141+
assertFalse(lines.toString().contains("&#39"))
142+
}
143+
109144

110145

111146
private fun buildEvaluatedIndividual(dbInitialization: MutableList<SqlAction>): Triple<OutputFormat, String, EvaluatedIndividual<RestIndividual>> {

0 commit comments

Comments
 (0)