Hi Keith,
 
Thanks for looking into these issues.
 
The question of how we will validate display logic going forward has yet
to be resolved.
 
For the purpose of these issues, manual verification will suffice.
However, if you'd like to poke around in a direction we are considering
going, then you could take a look at using SeleniumRC with tests driven
using Java and JUnit.  
 
We wouldn't be able to commit tests like these unless we made a decision
to move forward with this approach, so if you decided to look into this,
please submit any SeleniumRC tests as a separate patch.
 
Cheers,
--Van

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Keith Pierce
Sent: Monday, December 10, 2007 8:03 AM
To: Mifos-developer
Subject: [Mifos-developer] Unit tests for fixes to issues 1463,1464
(incorrect display of digits right of decimal point)


I've discovered the source of the defects -- The corresponding JSPs were
incorrectly bypassing the decimal display logic -- see details below.
 
Following developer guidelines, I'd like to create tests for this
behavior, but can't find any automated tests of display logic within
mifos. Mifos.org <http://mifos.org/>  mentions use of WATIR, and plans
to migrate to Selenium. I intend to practice with Selenium anyway and
can proceed with this before submitting the patch. Or, will manual
verification suffice? 
 
Please advise.
 
Keith Pierce
 
-----------------------------------
comment posted to the issue tracker:
 
This defect is caused by a JSP coding error, which causes the JSP to
bypass
logic that formats the correct number of digits to the right of the
decimal
point. Here are the details:
When instantiated with a monetary amount, a Money object retrieves
Currency.defaultDigitsAfterDecimal (from the CURRENCY table via
Hibernate) and
uses it to set the scale of its amount attribute -- a BigDecimal value.
Normally, when a JSP wants to display a monetary amount, it invokes the
"out"
custom tag with argument equal to the Money instance. This in turn
invokes
Money.toString(), which correctly formats the decimal display.

However, in 11 instances spread over 7 JSPs, the code first applies
amountDoubleValue to the Money.amount and then displays the double
value. Java
applies its own internal rules for formatting double values, effectively
bypassing MifOS conventions described above.

The fix is simple -- just remove the "amountDoubleValue" and apply the
"out" tag
to the Money object itself. I will make those changes and submit the
patch.

The JSPs involved are:
* view_centerchargesdetail.jsp
* view_clientchargesdetail.jsp
* viewClientDetails.jsp
* view_groupchargesdetail.jsp
* viewgroupdetails.jsp
* closesavingsaccount.jsp
* reviewclosesavings.jsp
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

Reply via email to