hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules SmartTranslator.java
Date Tue, 10 Aug 2004 13:18:50 GMT
hlship      2004/08/10 06:18:50

  Modified:    framework/src/test/hivemind/test/rules
                        TestSmartTranslator.java
               framework/src/java/org/apache/hivemind/schema/rules
                        SmartTranslator.java
  Log:
  HIVEMIND-29: SmartTranslator should differentiate between blank strings and null input
  
  Revision  Changes    Path
  1.5       +9 -2      jakarta-hivemind/framework/src/test/hivemind/test/rules/TestSmartTranslator.java
  
  Index: TestSmartTranslator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/rules/TestSmartTranslator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestSmartTranslator.java	18 Jul 2004 14:43:11 -0000	1.4
  +++ TestSmartTranslator.java	10 Aug 2004 13:18:50 -0000	1.5
  @@ -40,18 +40,25 @@
           assertEquals(new Integer(-37), result);
       }
   
  +    public void testNullInput()
  +    {
  +        Translator t = new SmartTranslator();
  +
  +        assertNull(t.translate(null, int.class, null, null));
  +    }
  +
       public void testBlankInput()
       {
           Translator t = new SmartTranslator();
   
  -        assertNull(t.translate(null, int.class, "", null));
  +        assertEquals("", t.translate(null, String.class, "", null));
       }
   
       public void testDefault()
       {
           Translator t = new SmartTranslator("default=100");
   
  -        Object result = t.translate(null, int.class, "", null);
  +        Object result = t.translate(null, int.class, null, null);
   
           assertEquals(new Integer(100), result);
       }
  
  
  
  1.5       +1 -2      jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/SmartTranslator.java
  
  Index: SmartTranslator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/SmartTranslator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SmartTranslator.java	18 Jul 2004 14:43:11 -0000	1.4
  +++ SmartTranslator.java	10 Aug 2004 13:18:50 -0000	1.5
  @@ -19,7 +19,6 @@
   import java.util.Map;
   
   import org.apache.hivemind.ApplicationRuntimeException;
  -import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.Location;
   import org.apache.hivemind.internal.Module;
   import org.apache.hivemind.schema.Translator;
  @@ -57,7 +56,7 @@
           String inputValue,
           Location location)
       {
  -        if (HiveMind.isBlank(inputValue))
  +        if (inputValue == null)
           {
               if (_default == null)
                   return null;
  
  
  

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


Mime
View raw message