commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject [beanutils] testing around ConvertUtils
Date Thu, 05 Mar 2009 08:22:33 GMT
In my unit tests I sometimes have the situation where I need to register my 
custom converters for ConvertUtils in order to make everything behave as it 
would in real life.

Normally the conversions are incidental to the test so it seems unnecessary to 
need to set up ConvertUtils.

Seeing inside the ConvertUtils class that there is a ConvertUtilsBean, I had the 
idea of using the ConvertUtilsBean in my classes, and initializing it via 
dependency injection.

Then I could mock it.

However all access to the ConvertUtilsBean via the singleton getInstance factory 
method is protected. Would it be unwise to instantiate it myself in my 
dependency injection container?


Thanks
Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message