hi,
Sorry for the of-topic but given that BeanUtils is heavily used in
Struts, can anyone suggest why this test does not pass neither in 1.7
nor 1.8? alternative way using BeanUtils? I had to end up implementing
my own Reflection-based copyProperties ...
//------------------------------------------------------------------------
public void
testCopyProperties()
throws Exception
{
class SomeBean
{
//----------------------------------------------------------------
public final double
getPropertyA()
{
return thePropertyA;
}
//----------------------------------------------------------------
public final void
setPropertyA(double aPropertyA)
{
thePropertyA = aPropertyA;
}
//----------------------------------------------------------------
public final double
getPropertyB()
{
return thePropertyB;
}
//----------------------------------------------------------------
public final void
setPropertyB(double aPropertyB)
{
thePropertyB = aPropertyB;
}
//----------------------------------------------------------------
/** (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String
toString()
{
return "(" + getPropertyA() + ", " + getPropertyB() + ")";
}
//----------------------------------------------------------------
// members
//----------------------------------------------------------------
private double thePropertyA = 0;
private double thePropertyB = 0;
}
Object myBean = new SomeBean();
String myExpected = "(1.0, 1.0)";
Map<String, Object> myMap = new HashMap<String, Object>();
myMap.put("PropertyA", 1.0);
myMap.put("PropertyB", 1.0);
BeanUtilsBean.getInstance().copyProperties(myBean, myMap);
assertEquals("BeanUtilsBean.copyProperties did not work as
expected",
myExpected, myBean.toString());
}
TIA,
regards,
Giovanni
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]