From d5aabd721a6900a714fed33fd5c44451189285b8 Mon Sep 17 00:00:00 2001 From: Marcus Da Coregio Date: Wed, 16 Nov 2022 14:50:04 -0300 Subject: [PATCH] Specify UTF8 for response content This is needed because in some other platforms, like Windows, the default charset might be different Issue gh-12026 --- .../saml2/provider/service/web/Saml2MetadataFilterTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java index 40ab5a83438..5de6effb87c 100644 --- a/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java +++ b/saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilterTests.java @@ -165,7 +165,7 @@ public void doFilterWhenCharacterEncodingThenEncodeSpecialCharactersCorrectly() this.filter.setMetadataFilename(testMetadataFilename); this.filter.doFilter(this.request, this.response, this.chain); assertThat(this.response.getCharacterEncoding()).isEqualTo(StandardCharsets.UTF_8.name()); - assertThat(new String(this.response.getContentAsByteArray())).isEqualTo(generatedMetadata); + assertThat(this.response.getContentAsString(StandardCharsets.UTF_8)).isEqualTo(generatedMetadata); } @Test