Skip to content

Commit

Permalink
Use charset in test (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo authored and michael-o committed Jul 22, 2024
1 parent adc67e1 commit 688714c
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);"));
}

Expand Down

0 comments on commit 688714c

Please sign in to comment.