Tapestry
  1. Tapestry
  2. TAPESTRY-1300

Unit tests require english locale to run succesfully

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 5.0.3
    • Fix Version/s: 5.0.3
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      DecimalFormat is localized, so the test against a string with the US decimal separator fails, the following patch changes this:

      Index: src/test/java/org/apache/tapestry/corelib/components/OutputTest.java
      ===================================================================
      — src/test/java/org/apache/tapestry/corelib/components/OutputTest.java
      (revision 511630)
      +++ src/test/java/org/apache/tapestry/corelib/components/OutputTest.java
      (working copy)
      @@ -18,18 +18,26 @@
      import java.text.FieldPosition;
      import java.text.Format;
      import java.text.ParsePosition;
      +import java.util.Locale;

      import org.apache.tapestry.ComponentResources;
      import org.apache.tapestry.MarkupWriter;
      import org.apache.tapestry.test.TapestryTestCase;
      import org.testng.annotations.Test;
      +import org.testng.annotations.BeforeClass;

      public class OutputTest extends TapestryTestCase
      {

      • private final Number _value = new Double(22.7d);
        + private final Number _value = 22.7d;
      • private final Format _format = new DecimalFormat("0.00");
        + private final Format _format = DecimalFormat.getInstance(Locale.US);

      + @BeforeClass
      + public void setUp()

      { + ((DecimalFormat)_format).applyPattern("0.00"); + }

      +
      +
      @Test
      public void simple_output()
      {

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Chris Poulsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development