From 688714c6e42434d2c3d70c9adca5709ba236b277 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sun, 21 Jul 2024 18:38:55 +0000 Subject: [PATCH] Use charset in test (#199) --- .../site/deploy/AbstractSiteDeployWebDavTest.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java b/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java index 99c43c6f..3e952413 100644 --- a/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java +++ b/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java @@ -19,6 +19,7 @@ package org.apache.maven.plugins.site.deploy; import java.io.File; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -52,6 +53,7 @@ public abstract class AbstractSiteDeployWebDavTest extends AbstractMojoTestCase File siteTargetPath = new File(getBasedir() + File.separator + "target" + File.separator + "siteTargetDeploy"); + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -217,14 +219,14 @@ public void davDeployThruProxyWitAuthzInProxy() throws Exception { } private void assertContentInFiles() throws Exception { - File fileToTest = new File(siteTargetPath, "site" + File.separator + "index.html"); - assertTrue(fileToTest.exists()); - String fileContent = FileUtils.readFileToString(fileToTest); + File htmlFile = new File(siteTargetPath, "site" + File.separator + "index.html"); + assertTrue(htmlFile.exists()); + String fileContent = FileUtils.readFileToString(htmlFile, StandardCharsets.UTF_8); assertTrue(fileContent.contains("Welcome to Apache Maven")); - fileToTest = new File(siteTargetPath, "site" + File.separator + "css" + File.separator + "maven-base.css"); - assertTrue(fileToTest.exists()); - fileContent = FileUtils.readFileToString(fileToTest); + File cssFile = new File(siteTargetPath, "site" + File.separator + "css" + File.separator + "maven-base.css"); + assertTrue(cssFile.exists()); + fileContent = FileUtils.readFileToString(cssFile, StandardCharsets.UTF_8); assertTrue(fileContent.contains("background-image: url(../images/collapsed.gif);")); }