Skip to content

Commit 8666c86

Browse files
Avery-DunnCopilot
andcommitted
Address PR review feedback: fix remaining reversed assertEquals args, use StandardCharsets.UTF_8
- Fix reversed assertEquals in WSTrustRequestTest (StringEscapeUtils as expected) - Fix reversed assertEquals in HelperAndUtilityTest (convertedInternalMap.size as expected) - Use StandardCharsets.UTF_8 instead of string literal in SeleniumDiagnostics Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 84b1b0b commit 8666c86

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

msal4j-sdk/src/integrationtest/java/infrastructure/SeleniumDiagnostics.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import java.io.File;
1515
import java.io.IOException;
16+
import java.nio.charset.StandardCharsets;
1617
import java.nio.file.Files;
1718
import java.nio.file.Path;
1819
import java.nio.file.Paths;
@@ -108,7 +109,7 @@ static void capturePageSource(WebDriver driver, String filePrefix) {
108109
content.append(pageSource);
109110

110111
Path destination = getOutputPath(filePrefix + ".html");
111-
Files.write(destination, content.toString().getBytes("UTF-8"));
112+
Files.write(destination, content.toString().getBytes(StandardCharsets.UTF_8));
112113
LOG.info("Page source saved: {}", destination);
113114
} catch (Exception e) {
114115
LOG.warn("Failed to capture page source: {}", e.getMessage());
@@ -142,7 +143,7 @@ static void captureBrowserLogs(WebDriver driver, String filePrefix) {
142143
}
143144

144145
Path destination = getOutputPath(filePrefix + "-console.log");
145-
Files.write(destination, content.toString().getBytes("UTF-8"));
146+
Files.write(destination, content.toString().getBytes(StandardCharsets.UTF_8));
146147
LOG.info("Browser logs saved: {}", destination);
147148
} catch (Exception e) {
148149
LOG.warn("Failed to capture browser logs: {} (this may be expected if logging prefs are not supported)", e.getMessage());

msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/HelperAndUtilityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void StringHelper_convertToMultiValueMap() {
7878
assertNotNull(convertedInternalMap, "Converted map should not be null");
7979
assertNotNull(methodReturnedMap, "Method returned map should not be null");
8080

81-
assertEquals(methodReturnedMap.size(), convertedInternalMap.size(), "Maps should have the same size");
81+
assertEquals(convertedInternalMap.size(), methodReturnedMap.size(), "Maps should have the same size");
8282

8383
for (String key : convertedInternalMap.keySet()) {
8484
assertTrue(methodReturnedMap.containsKey(key), "Method returned map should contain key: " + key);

msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/WSTrustRequestTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void escapeXMLElementDataTest() {
5151
String XML_ESCAPED_DATA = "o_!as &amp; a34~&apos;fe&lt;&gt; &quot; a1";
5252

5353
assertEquals(XML_ESCAPED_DATA, WSTrustRequest.escapeXMLElementData(DATA_TO_ESCAPE));
54-
assertEquals(WSTrustRequest.escapeXMLElementData(DATA_TO_ESCAPE),
55-
StringEscapeUtils.escapeXml10(DATA_TO_ESCAPE));
54+
assertEquals(StringEscapeUtils.escapeXml10(DATA_TO_ESCAPE),
55+
WSTrustRequest.escapeXMLElementData(DATA_TO_ESCAPE));
5656
}
5757
}

0 commit comments

Comments
 (0)