private String runCreateFileAndGetContent(String[] args) throws Exception {
   updater.parseCommandLine(args);
   File resultFile = updater.createUpdateList();
   String content = FileUtil.getFileContent(resultFile);
   FileUtil.deleteFile(resultFile);
   return content;
 }
 @Test
 public void shouldPutSpecialFilesInDifferentList() throws Exception {
   String arg1 = "-doNotReplace:MasterFolder/TestFolder/fitnesse.css";
   String arg2 = "-doNotReplace:MasterFolder/TestFolder/fitnesse_print.css";
   updater.parseCommandLine(new String[] {arg1, arg2, "MasterFolder/TestFolder"});
   File doNotUpdateFile = updater.createDoNotUpdateList();
   String doNotUpdateContent = FileUtil.getFileContent(doNotUpdateFile);
   FileUtil.deleteFile(doNotUpdateFile);
   assertSubString("TestFolder/fitnesse.css", doNotUpdateContent);
   assertSubString("TestFolder/fitnesse_print.css", doNotUpdateContent);
   assertDoesntHaveRegexp("TestFolder/TestFile", doNotUpdateContent);
 }
Example #3
0
  @Test
  public void systemPropertiesTakePrecedenceOverConfiguredProperties() throws Exception {
    final String configFileName =
        "systemPropertiesTakePrecedenceOverConfiguredProperties.properties";
    FileUtil.createFile(configFileName, "Theme=example");

    System.setProperty("Theme", "othertheme");
    try {
      // Checked via logging:
      String output = runFitnesseMainWith("-o", "-c", "/root", "-f", configFileName);
      assertThat(output, containsString("othertheme"));
    } finally {
      System.getProperties().remove("Theme");
      FileUtil.deleteFile(configFileName);
    }
  }