You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2013/04/03 03:27:15 UTC

[jira] [Created] (LOG4J2-194) broken JUnit test ThrowableFormatOptionsTest (breaks the build)

Remko Popma created LOG4J2-194:
----------------------------------

             Summary: broken JUnit test ThrowableFormatOptionsTest (breaks the build)
                 Key: LOG4J2-194
                 URL: https://issues.apache.org/jira/browse/LOG4J2-194
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
            Reporter: Remko Popma


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.
Current: ThrowableFormatOptionsTest.testSeparatorAsDefaultLineSeparator (line 140)
  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);


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org