Uploaded image for project: 'JSPWiki'
  1. JSPWiki
  2. JSPWIKI-882

Fix test-failure when using existing localized locale in OutComeTest

Bulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 2.10.1
    • 2.10.2
    • Build system
    • None


      Test failure when using e.g. LANG=nl_NL@UTF-8 during building.

      Patch illustrating the problem and a suggested fix at
      http://www.xs4all.nl/~fiberbit/0001-Fix-test-failure-when-using-existing-localized-local.patch and here inline:

      commit 68aef722b678862fd48d3916a63fa585a0294f9b
      Author: Marco Roeland <marco.roeland@xs4all.nl>
      Date: Sat May 30 13:56:56 2015 +0200

      Fix test-failure when using existing localized locale in OutComeTest

      Some tests in OutComeTest expect results from the "root" resources, so
      basically the non-localized strings. To cater for running the tests under
      all sorts of locales and making the outcome predictable, a locale is
      explicitly set. Nice and good.

      Ironically however, the Locale used (Locale.ENGLISH) searches for
      CoreResources_en.properties which is not present in our distribution and we
      fall back on the "default", which is determined by the environment or JVM
      settings. Exactly what we don't want.

      Fix this by using the Locale.ROOT constant.

      To reproduce the bug set your LANG environment variable to e.g. nl_NL.UTF-8
      and the test fails with the following. Setting LANG=C passes the test.

      Running org.apache.wiki.workflow.OutcomeTest
      Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
      <<< FAILURE! - in org.apache.wiki.workflow.OutcomeTest
      testMessage(org.apache.wiki.workflow.OutcomeTest) Time elapsed: 0.014 sec
      <<< FAILURE!
      junit.framework.ComparisonFailure: expected:<[Approve]> but was:<[Keur goed]>
      at junit.framework.Assert.assertEquals(Assert.java:100)
      at junit.framework.Assert.assertEquals(Assert.java:107)
      at junit.framework.TestCase.assertEquals(TestCase.java:269)
      at org.apache.wiki.workflow.OutcomeTest.testMessage(OutcomeTest.java:65)

      Tested on 2.10.2-svn-15, subversion R1674539.

      jspwiki-war/src/test/java/org/apache/wiki/workflow/OutcomeTest.java | 10 +++++-----
      1 file changed, 5 insertions, 5 deletions

      diff --git a/jspwiki-war/src/test/java/org/apache/wiki/workflow/OutcomeTest.java b/jspwiki-war/src/test/java/org/apache/wiki/workflow/OutcomeTest.java
      index 3e4a569..c2ba204 100644
      — a/jspwiki-war/src/test/java/org/apache/wiki/workflow/OutcomeTest.java
      +++ b/jspwiki-war/src/test/java/org/apache/wiki/workflow/OutcomeTest.java
      @@ -58,20 +58,20 @@ public class OutcomeTest extends TestCase
      WikiEngine engine = new TestEngine(props);
      InternationalizationManager i18n = engine.getInternationalizationManager();
      String core = "templates.default";

      • Locale english = Locale.ENGLISH;
        + Locale root = Locale.ROOT;
        Outcome o;

      o = Outcome.DECISION_APPROVE;

      • assertEquals("Approve", i18n.get(core, english, o.getMessageKey()));
        + assertEquals("Approve", i18n.get(core, root, o.getMessageKey()));

      o = Outcome.DECISION_DENY;

      • assertEquals("Deny", i18n.get(core, english, o.getMessageKey()));
        + assertEquals("Deny", i18n.get(core, root, o.getMessageKey()));

      o = Outcome.DECISION_HOLD;

      • assertEquals("Hold", i18n.get(core, english, o.getMessageKey()));
        + assertEquals("Hold", i18n.get(core, root, o.getMessageKey()));

      o = Outcome.DECISION_REASSIGN;

      • assertEquals("Reassign", i18n.get(core, english, o.getMessageKey()));
        + assertEquals("Reassign", i18n.get(core, root, o.getMessageKey()));

      public void testIsCompletion()



          This comment will be Viewable by All Users Viewable by All Users


            metskem Harry Metske
            marco.roeland Marco Roeland
            0 Vote for this issue
            2 Start watching this issue




                Issue deployment