Author: ivaynberg
Date: Fri Dec 11 17:23:20 2009
New Revision: 889713

URL: http://svn.apache.org/viewvc?rev=889713&view=rev
Log:
WICKET-2609 EnumChoiceRenderer fix
Issue: WICKET-2609

Added:
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java
   (with props)
Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java?rev=889713&r1=889712&r2=889713&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java
 Fri Dec 11 17:23:20 2009
@@ -94,7 +94,7 @@
         */
        protected String resourceKey(T object)
        {
-               return object.getClass().getSimpleName() + "." + object.name();
+               return object.getDeclaringClass().getSimpleName() + "." + 
object.name();
        }
 
        /**

Added: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java?rev=889713&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java
 (added)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java
 Fri Dec 11 17:23:20 2009
@@ -0,0 +1,35 @@
+package org.apache.wicket.markup.html.form;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * Tests {...@link EnumChoiceRenderer}
+ * 
+ * @author igor.vaynberg
+ */
+public class EnumChoiceRendererTest extends TestCase
+{
+
+       /**
+        * 
+        */
+       public void testResourceKeyGenerationForAnonymousEnums()
+       {
+               final EnumChoiceRenderer<TestEnum> renderer = new 
EnumChoiceRenderer<TestEnum>();
+               Assert.assertEquals("TestEnum.ANONYMOUS", 
renderer.resourceKey(TestEnum.ANONYMOUS));
+       }
+
+       /**
+        * Enum for testing
+        * 
+        * @author igor.vaynberg
+        */
+       public enum TestEnum {
+               /** an anonymous enum value */
+               ANONYMOUS {
+               // anonymous enum value
+               }
+       }
+
+}

Propchange: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to