1 package org.testng.reporters;
2 
3 import org.testng.internal.Utils;
4 
5 import java.io.File;
6 import java.io.IOException;
7 
8 public class HtmlHelper {
9   private static final String CSS_FILE_NAME = "testng.css";
10   private static final String MY_CSS_FILE_NAME = "my-testng.css";
11 
getCssString()12   static public String getCssString() {
13     return getCssString("..");
14   }
15 
getCssString(String directory)16   static public String getCssString(String directory) {
17     return
18       "<link href=\"" + directory + "/" + CSS_FILE_NAME + "\" rel=\"stylesheet\" type=\"text/css\" />\n" +
19       "<link href=\"" + directory + "/"+ MY_CSS_FILE_NAME + "\" rel=\"stylesheet\" type=\"text/css\" />\n";
20   }
21 
generateStylesheet(String outputDirectory)22   public static File generateStylesheet(String outputDirectory) throws IOException {
23     File stylesheetFile = new File(outputDirectory, CSS_FILE_NAME);
24     if (!stylesheetFile.exists()) {
25       Utils.writeResourceToFile(stylesheetFile, CSS_FILE_NAME, TestHTMLReporter.class);
26     }
27     return stylesheetFile;
28   }
29 }
30