[Building Sakai] [Management] MT deprecation recommendations for 2.7

Aaron Zeckoski azeckoski at unicon.net
Thu Mar 18 06:23:11 PDT 2010


I think what Anthony is getting as is related to mocking the services
called by the static covers.
Use of the static covers does not allow testing of the method because
normally the tests would use a mock object for the service. It is
difficult to create a mock for a for a static class (not impossible
using some of the newer mocking packages like easymock). I makes it
impossible to test it using more basic testing methods (like creating
your own mock object).

This certainly has made my life very difficult when writing tests for
Sakai 2 methods and often requires me to change the method first so it
does not use the covers before i can write the tests. If writing
integration tests this has little actual impact so use of covers
doesn't make much difference there.

-AZ


On Thu, Mar 18, 2010 at 1:08 PM, Mark Norton <markjnorton at earthlink.net> wrote:
> Anthony Whyte wrote:
>> is it really all that challenging to add a service injection setter method that relies on a bit of XML residing in a Spring bean configuration file?
> For you and I - no.  For a Java developer familiar with Spring -
> probably not.  However, I've  trained dozens of developers in Sakai tool
> development who are NOT familiar with Spring or even the concept of
> injection.  While admittedly a crude approach to solving the problem,
> covers are considerably easier for non-Spring Java programmers, or
> (perhaps more importantly) experienced non-Java programmers.
>> COMPROMISE PROPOSAL
>> I'd like to see static covers eventually removed (so +1) but recognize that the current crowd wisdom appears to consider this desire, well, unwise.  Still, I'd like to suggest a compromise proposal, one that permits the removal of a static cover whenever it impedes the implementation of unit tests written in support of a bug fix.
> What is the problem of writing unit tests and the presence of service
> manager covers?  If the cover is a method duplicate of the service
> manager, unit tests should work equally well for both (with the addition
> of the getInstance() method).
>> Extension of 2.x unit test coverage is work that meets a long standing yet largely unrealized goal of the Sakai Community.  Suspending such work because one finds a static cover in the way appears to me unwise.
>>
> I'd like to understand how it is in the way.
>
> - Mark
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>



-- 
Aaron Zeckoski - Software Engineer - http://tinyurl.com/azprofile


More information about the sakai-dev mailing list