Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
1.5.1, 1.5.3
-
None
-
not related to env
Description
StringResourceModel skip first parameter in va args parameters, in case if first parameter has string type. Works on in case if first parameter non string type.
Way to reproduce.
1. locate StringResourceModelTest$TestPage.properties in apache-wicket-1.5.3\src\wicket-core\src\test\java\org\apache\wicket\model
2. add following line: simple.bug=Hi i am new bug.
{1}
3. change StringResourceModelTest#getSimpleResource()
public void getSimpleResource()
{ StringResourceModel model = new StringResourceModel("simple.text", page, null); Assert.assertEquals("Text should be as expected", "Simple text", model.getString()); Assert.assertEquals("Text should be as expected", "Simple text", model.getObject()); StringResourceModel thisWorksModel = new StringResourceModel("simple.bug", page, null, new java.math.BigDecimal("100"), "500"); Assert.assertEquals("Text should be as expected", "Hi i am new bug. 100 500", thisWorksModel.getObject()); //will be failed StringResourceModel bugModel = new StringResourceModel("simple.bug", page, null, "Already", "fixed"); Assert.assertEquals("Text should be as expected", "Hi i am new bug. Already fixed", bugModel.getObject()); }
4. expected result - all tests passed
5. actual result assertion failed - Assert.assertEquals("Text should be as expected", "Hi i am new bug. Already fixed", bugModel.getObject());
-------------------------------------------------------------------------------
Test set: org.apache.wicket.model.StringResourceModelTest
-------------------------------------------------------------------------------
Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.974 sec <<< FAILURE!
getSimpleResource(org.apache.wicket.model.StringResourceModelTest) Time elapsed: 0.745 sec <<< FAILURE!
junit.framework.ComparisonFailure: Text should be as expected expected:<Hi i am new bug. [Already fixed]> but was:<Hi i am new bug. [fixed {1}
]>
Attachments
Issue Links
- relates to
-
WICKET-4972 Remove (or disarm) varargs contructors of StringResourceModel (more of a pitfall than convenience)
- Resolved