@Test
  public void testGetFilePathFromFileSystem() throws Exception {
    helper = new ClassPathGeneratorHelper();
    String filePath = helper.getFilePath("generator/classpath/temp.css");
    assertEquals(
        FileUtils.getClassPathFile("generator/classpath/temp.css").getAbsolutePath(), filePath);

    filePath = helper.getFilePath("generator/classpath/a file with space.css");
    assertEquals(
        FileUtils.getClassPathFile("generator/classpath/a file with space.css").getAbsolutePath(),
        filePath);
  }
 @Test
 public void testPostProcessBundle() throws Exception {
   CssCharsetFilterPostProcessor processor = new CssCharsetFilterPostProcessor();
   StringBuffer sb =
       new StringBuffer(
           FileUtils.readClassPathFile("postprocessor/cssbundlecharset/standard-bundle.css"));
   BundleProcessingStatus status =
       new BundleProcessingStatus(BundleProcessingStatus.FILE_PROCESSING_TYPE, bundle, null, null);
   StringBuffer ret = processor.postProcessBundle(status, sb);
   assertEquals(
       FileUtils.readClassPathFile("postprocessor/cssbundlecharset/standard-bundle-result.css"),
       ret.toString());
 }
  @Test
  public void testPostProcessSimpleJS() throws Exception {

    String src = FileUtils.readClassPathFile("postprocessor/js/uglify/simpleJS.js");
    StringBuffer sb = new StringBuffer(src);

    BundleProcessingStatus status =
        new BundleProcessingStatus(
            BundleProcessingStatus.BUNDLE_PROCESSING_TYPE, bundle, null, config);
    StringBuffer ret = processor.postProcessBundle(status, sb);

    String expected = FileUtils.readClassPathFile("postprocessor/js/uglify/simpleJS_expected.js");
    assertEquals(expected, ret.toString());
  }
  @Test
  public void testPostProcessWithOutputOptions() throws Exception {

    String src = FileUtils.readClassPathFile("postprocessor/js/uglify/simpleJS.js");
    StringBuffer sb = new StringBuffer(src);
    when(config.getProperty(JawrConstant.UGLIFY_POSTPROCESSOR_OPTIONS, "{}"))
        .thenReturn("{output : {comments : /@preserve/ }}");
    BundleProcessingStatus status =
        new BundleProcessingStatus(
            BundleProcessingStatus.BUNDLE_PROCESSING_TYPE, bundle, null, config);
    StringBuffer ret = processor.postProcessBundle(status, sb);

    String expected =
        FileUtils.readClassPathFile(
            "postprocessor/js/uglify/simpleJS_WithOutputOptions_expected.js");
    assertEquals(expected, ret.toString());
  }
  @Test
  public void testPostProcessBundleWithDifferentCharsetWarning() throws Exception {

    CssCharsetFilterPostProcessor processor = new CssCharsetFilterPostProcessor();
    StringBuffer sb =
        new StringBuffer(
            FileUtils.readClassPathFile(
                "postprocessor/cssbundlecharset/different-charset-decl-bundle.css"));
    BundleProcessingStatus status =
        new BundleProcessingStatus(BundleProcessingStatus.FILE_PROCESSING_TYPE, bundle, null, null);
    StringBuffer ret = processor.postProcessBundle(status, sb);
    assertEquals(
        FileUtils.readClassPathFile(
            "postprocessor/cssbundlecharset/different-charset-decl-bundle-result.css"),
        ret.toString());

    String[] messages = AppenderForTesting.getMessages();
    assertEquals(2, messages.length);
    assertEquals(
        "The bundle '/bundle1.css' contains CSS with different charset declaration.", messages[1]);
  }