Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1300

Unit tests require english locale to run succesfully

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 5.0.3
    • 5.0.3
    • tapestry-core
    • 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()
      {

      Attachments

        Activity

          People

            Unassigned Unassigned
            chrispoulsen Chris Poulsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: