Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-194

broken JUnit test ThrowableFormatOptionsTest (breaks the build on Windows)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0-beta5
    • Core
    • None

    Description

      Failed tests: testSeparatorAsDefaultLineSeparator(org.apache.logging.log4j.core.impl.ThrowableFormatOptionsTest): getS](..)tor expected:<[

      Tests run: 205, Failures: 1, Errors: 0, Skipped: 0

      [INFO] ------------------------------------------------------------------------
      [INFO] Reactor Summary:
      [INFO]
      [INFO] Apache Log4j 2 .................................... SUCCESS [12.843s]
      [INFO] Apache Log4j API .................................. SUCCESS [22.624s]
      [INFO] Apache Log4J Core ................................. FAILURE [3:11.442s]
      [INFO] Apache Log4j 1.x Compatibility API ................ SKIPPED
      [INFO] Apache Log4j SLF4J Binding ........................ SKIPPED
      [INFO] Apache Log4j to SLF4J Adapter ..................... SKIPPED
      [INFO] Apache Log4j Commons Logging Bridge ............... SKIPPED
      [INFO] Apache Log4j Flume NG Bridge ...................... SKIPPED
      [INFO] Log4j Web Adapters ................................ SKIPPED
      [INFO] log4j-samples ..................................... SKIPPED
      [INFO] flume-common ...................................... SKIPPED
      [INFO] flume-remote ...................................... SKIPPED
      [INFO] flume-embedded .................................... SKIPPED
      [INFO] Apache Log4j Async ................................ SKIPPED
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3:47.940s
      [INFO] Finished at: Wed Apr 03 09:47:44 JST 2013
      [INFO] Final Memory: 12M/56M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project log4
      j-core: There are test failures.

      I ran the test in a debugger.
      The expected value (Constants.LINE_SEP) is "\r\n" on my platform (Windows).
      The actual value (throwableFormatOptions.getSeparator()) is "\n". (So the pattern "separator(\n)" is parsed correctly.)

      The solution would be to either change the expected value to match the pattern or the other way around.

      ThrowableFormatOptionsTest.testSeparatorAsDefaultLineSeparator (line 140)
      Current:
      test(new String[]

      {"separator(\n)"}, Integer.MAX_VALUE, Constants.LINE_SEP, null);

      Proposed:
      test(new String[]{"separator(n)"}

      , Integer.MAX_VALUE, "\n", null);
      or:
      String pattern = "separator(" + Constants.LINE_SEP + ")";
      test(new String[]

      {pattern}

      , Integer.MAX_VALUE, Constants.LINE_SEP, null);

      Attachments

        Activity

          People

            rgoers Ralph Goers
            rpopma Remko Popma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: