Skip to content

Commit a6efa2a

Browse files
committed
Test: Add case for basic HTML entities in HtmlUtils
Signed-off-by: potato <[email protected]>
1 parent 0b60800 commit a6efa2a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

spring-web/src/test/java/org/springframework/web/util/HtmlCharacterEntityDecoderTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,18 @@ void unescapeHandlesSupplementaryCharactersCorrectly() {
2323
assertEquals(expectedCharacter, actualResultFromDecimal, "Decimal entity was not converted correctly.");
2424
assertEquals(expectedCharacter, actualResultFromHex, "Hexadecimal entity was not converted correctly.");
2525
}
26-
}
26+
27+
@Test
28+
@DisplayName("Should correctly unescape basic and named HTML entities")
29+
void unescapeHandlesBasicEntities() {
30+
// Arrange
31+
String input = "&lt;p&gt;Tom &amp; Jerry&#39;s &quot;Show&quot;&lt;/p&gt;";
32+
String expectedOutput = "<p>Tom & Jerry's \"Show\"</p>";
33+
34+
// Act
35+
String actualOutput = HtmlUtils.htmlUnescape(input);
36+
37+
// Assert
38+
assertEquals(expectedOutput, actualOutput, "Basic HTML entities were not unescaped correctly.");
39+
}
40+
}

0 commit comments

Comments
 (0)