commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Raess <co...@gmx.ch>
Subject Re: [PATCH] CLI NumberValidatorTest
Date Thu, 25 Mar 2004 06:23:58 GMT
hmm, your right. no problem.

-- snip --
Index:  
src/test/org/apache/commons/cli2/validation/NumberValidatorTest.java
===================================================================
RCS file:  
/home/cvspublic/jakarta-commons/cli/src/test/org/apache/commons/cli2/ 
validation/Attic/NumberValidatorTest.java,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 NumberValidatorTest.java
---  
src/test/org/apache/commons/cli2/validation/NumberValidatorTest.java	8  
Feb 2004 13:09:00 -0000	1.1.2.5
+++  
src/test/org/apache/commons/cli2/validation/NumberValidatorTest.java	24  
Mar 2004 22:17:05 -0000
@@ -24,7 +24,12 @@

  public class NumberValidatorTest extends TestCase {
      public void testValidate_Number() throws InvalidArgumentException {
-        final Object[] array = new Object[] { "1", "1.07", "-.45" };
+	    NumberFormat format = NumberFormat.getNumberInstance();
+        final Object[] array =
+            new Object[] {
+                format.format(1d),
+                format.format(1.07d),
+                format.format(-.45d)};
          final List list = Arrays.asList(array);
          final Validator validator =  
NumberValidator.getNumberInstance();

@@ -57,7 +62,13 @@
      }

      public void testValidate_Percent() throws InvalidArgumentException  
{
-        final Object[] array = new Object[] { "1%", "107%", "-45%",  
"0.001%" };
+        NumberFormat format = NumberFormat.getPercentInstance();
+        final Object[] array =
+            new Object[] {
+                format.format(.01),
+                format.format(1.07),
+                format.format(-.45),
+                format.format(.00001)};
          final List list = Arrays.asList(array);
          final Validator validator =  
NumberValidator.getPercentInstance();


Am 25.03.2004 um 01:30 schrieb John Keyes:

> Hi Simon,
>
> Can you inline the patch, the attachment doesn't appear to have made  
> it through.
>
> Thanks for the help,
> -John K
>
>
> Simon Raess wrote:
>
>> hi
>> I've downloaded the latest sources from commons-cli from the branch  
>> RESEARCH_CLI_2_ROXSPRING and tried to run the tests with maven. The  
>> following tests failed:
>> org.apache.commons.cli2.NumberValidatorTest
>>  - testValidate_Number
>>  - testValidate_Percent
>> The attached patch fixes the 'bugs' in the tests. The problem was  
>> caused by some 'locale-specific' behavior.
>> org.apache.commons.cli2.jdepend.JDependTest
>>  - testAcceptableDistance
>> The distance for package org.apache.commons.cli2.commandline was 0.25  
>> (according to the test, it must be < 0.2).
>> Hope this helps
>> Simon
>> ---------------------------------------------------------------------- 
>> --
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


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


Mime
View raw message