You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2010/02/20 20:28:57 UTC

Re: svn commit: r911954 - /commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java

On 19/02/2010, niallp@apache.org <ni...@apache.org> wrote:
> Author: niallp
>  Date: Fri Feb 19 19:54:13 2010
>  New Revision: 911954
>
>  URL: http://svn.apache.org/viewvc?rev=911954&view=rev
>  Log:
>  LANG-76 Add a test case to try and reproduce

I was able to reproduce the problem using a plain Java main() test.

Don't have access to it currently, but I'm fairly sure I used a
separate file for the Enum class - that might be why the test is not
failing for you.

>  Modified:
>     commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java
>
>  Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java
>  URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java?rev=911954&r1=911953&r2=911954&view=diff
>  ==============================================================================
>  --- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java (original)
>  +++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java Fri Feb 19 19:54:13 2010
>  @@ -157,4 +157,21 @@
>          } catch (IllegalArgumentException ex) {}
>      }
>
>  +    /** Test for LANG-76 **/
>  +    public void testGetEnum_LANG76() {
>  +        Object obj = EnumUtils.getEnum(Lang76Enum.class, "1");
>  +        assertNotNull(obj);
>  +        assertEquals("EnumUtilsTest.Lang76Enum[1]", obj.toString());
>  +    }
>  +
>  +    /** Test Enum for LANG-76 **/
>  +    public static final class Lang76Enum  extends Enum {
>  +        public static final Lang76Enum ONE     = new Lang76Enum("1");
>  +        public static final Lang76Enum TWO     = new Lang76Enum("2");
>  +        public static final Lang76Enum THREE   = new Lang76Enum("3");
>  +
>  +        private Lang76Enum(String suit) {
>  +            super(suit);
>  +        }
>  +    }
>   }
>
>
>

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


Re: svn commit: r911954 - /commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java

Posted by Niall Pemberton <ni...@gmail.com>.
On Sat, Feb 20, 2010 at 8:57 PM, Niall Pemberton
<ni...@gmail.com> wrote:
> On Sat, Feb 20, 2010 at 7:28 PM, sebb <se...@gmail.com> wrote:
>> On 19/02/2010, niallp@apache.org <ni...@apache.org> wrote:
>>> Author: niallp
>>>  Date: Fri Feb 19 19:54:13 2010
>>>  New Revision: 911954
>>>
>>>  URL: http://svn.apache.org/viewvc?rev=911954&view=rev
>>>  Log:
>>>  LANG-76 Add a test case to try and reproduce
>>
>> I was able to reproduce the problem using a plain Java main() test.
>>
>> Don't have access to it currently, but I'm fairly sure I used a
>> separate file for the Enum class - that might be why the test is not
>> failing for you.
>
> OK I've tried just running java from the command line with a main()
> method and the enum in a separate class - but it still works OK for me
> (using Sun's JDK 1.5.0_01 and 1.5.0_22 on Windows XP). If you
> reproduce it again, could you document the scenario on the ticket.

It needed the test to be compiled with source/target set to 1.5 to
reproduce it and I have now fixed it:

https://issues.apache.org/jira/browse/LANG-76

Niall

> Niall
>
>>>  Modified:
>>>     commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java
>>>
>>>  Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java
>>>  URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java?rev=911954&r1=911953&r2=911954&view=diff
>>>  ==============================================================================
>>>  --- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java (original)
>>>  +++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java Fri Feb 19 19:54:13 2010
>>>  @@ -157,4 +157,21 @@
>>>          } catch (IllegalArgumentException ex) {}
>>>      }
>>>
>>>  +    /** Test for LANG-76 **/
>>>  +    public void testGetEnum_LANG76() {
>>>  +        Object obj = EnumUtils.getEnum(Lang76Enum.class, "1");
>>>  +        assertNotNull(obj);
>>>  +        assertEquals("EnumUtilsTest.Lang76Enum[1]", obj.toString());
>>>  +    }
>>>  +
>>>  +    /** Test Enum for LANG-76 **/
>>>  +    public static final class Lang76Enum  extends Enum {
>>>  +        public static final Lang76Enum ONE     = new Lang76Enum("1");
>>>  +        public static final Lang76Enum TWO     = new Lang76Enum("2");
>>>  +        public static final Lang76Enum THREE   = new Lang76Enum("3");
>>>  +
>>>  +        private Lang76Enum(String suit) {
>>>  +            super(suit);
>>>  +        }
>>>  +    }
>>>   }
>>>
>

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


Re: svn commit: r911954 - /commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java

Posted by Niall Pemberton <ni...@gmail.com>.
On Sat, Feb 20, 2010 at 7:28 PM, sebb <se...@gmail.com> wrote:
> On 19/02/2010, niallp@apache.org <ni...@apache.org> wrote:
>> Author: niallp
>>  Date: Fri Feb 19 19:54:13 2010
>>  New Revision: 911954
>>
>>  URL: http://svn.apache.org/viewvc?rev=911954&view=rev
>>  Log:
>>  LANG-76 Add a test case to try and reproduce
>
> I was able to reproduce the problem using a plain Java main() test.
>
> Don't have access to it currently, but I'm fairly sure I used a
> separate file for the Enum class - that might be why the test is not
> failing for you.

OK I've tried just running java from the command line with a main()
method and the enum in a separate class - but it still works OK for me
(using Sun's JDK 1.5.0_01 and 1.5.0_22 on Windows XP). If you
reproduce it again, could you document the scenario on the ticket.

Niall

>>  Modified:
>>     commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java
>>
>>  Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java
>>  URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java?rev=911954&r1=911953&r2=911954&view=diff
>>  ==============================================================================
>>  --- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java (original)
>>  +++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/enums/EnumUtilsTest.java Fri Feb 19 19:54:13 2010
>>  @@ -157,4 +157,21 @@
>>          } catch (IllegalArgumentException ex) {}
>>      }
>>
>>  +    /** Test for LANG-76 **/
>>  +    public void testGetEnum_LANG76() {
>>  +        Object obj = EnumUtils.getEnum(Lang76Enum.class, "1");
>>  +        assertNotNull(obj);
>>  +        assertEquals("EnumUtilsTest.Lang76Enum[1]", obj.toString());
>>  +    }
>>  +
>>  +    /** Test Enum for LANG-76 **/
>>  +    public static final class Lang76Enum  extends Enum {
>>  +        public static final Lang76Enum ONE     = new Lang76Enum("1");
>>  +        public static final Lang76Enum TWO     = new Lang76Enum("2");
>>  +        public static final Lang76Enum THREE   = new Lang76Enum("3");
>>  +
>>  +        private Lang76Enum(String suit) {
>>  +            super(suit);
>>  +        }
>>  +    }
>>   }
>>

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