Skip to content

Commit b7cb589

Browse files
jeremylongCopilot
andauthored
fix: apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9094b64 commit b7cb589

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/src/test/java/org/owasp/encoder/XML11EncoderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void testXML11C0ControlChars() {
206206
char ch = (char) i;
207207
String input = "a" + ch + "b";
208208
String result = Encode.forXml11(input);
209-
String expected = "a&#x" + Integer.toHexString(i) + ";b";
209+
String expected = "a&#x" + String.format("%02x", i) + ";b";
210210
assertEquals("C0 control char 0x" + Integer.toHexString(i) + " should be encoded",
211211
expected, result);
212212
}
@@ -225,8 +225,8 @@ public void testXML11C1ControlChars() {
225225
char ch = (char) i;
226226
String input = "a" + ch + "b";
227227
String result = Encode.forXml11(input);
228-
String expected = "a&#x" + Integer.toHexString(i) + ";b";
229-
assertEquals("C1 control char 0x" + Integer.toHexString(i) + " should be encoded",
228+
String expected = "a&#x" + String.format("%02x", i) + ";b";
229+
assertEquals("C1 control char 0x" + String.format("%02x", i) + " should be encoded",
230230
expected, result);
231231
}
232232
}

0 commit comments

Comments
 (0)