Author: ivaynberg Date: Fri Dec 11 17:22:46 2009 New Revision: 889711 URL: http://svn.apache.org/viewvc?rev=889711&view=rev Log: WICKET-2609 EnumChoiceRenderer fix Issue: WICKET-2609
Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java (with props) Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java?rev=889711&r1=889710&r2=889711&view=diff ============================================================================== --- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java (original) +++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/EnumChoiceRenderer.java Fri Dec 11 17:22:46 2009 @@ -94,7 +94,7 @@ */ protected String resourceKey(T object) { - return object.getClass().getSimpleName() + "." + object.name(); + return object.getDeclaringClass().getSimpleName() + "." + object.name(); } /** Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java?rev=889711&view=auto ============================================================================== --- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java (added) +++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java Fri Dec 11 17:22:46 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/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/EnumChoiceRendererTest.java ------------------------------------------------------------------------------ svn:mime-type = text/plain