jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kazuhito SUGURI <suguri.kazuh...@lab.ntt.co.jp>
Subject Re: class hierarchy and extending a Cactus Test Case
Date Fri, 20 Jul 2007 08:53:58 GMT

In article <300a54010707181416i5879589q1c8de92fd7d7b174@mail.gmail.com>,
Wed, 18 Jul 2007 16:16:56 -0500,
"Jay Baker" <jbaker.work@gmail.com> wrote: 
jbaker.work> Thank you for your interest. Let's say that I have a base class that is used
jbaker.work> for regular (not in container) test cases. Call this MyBaseTestCase. I have
jbaker.work> other test classes that extend this base class. The base class provides
jbaker.work> services that I need and the current design uses inheritance. For example,
jbaker.work> it uses a template pattern approach to enforce that some metadata is
jbaker.work> available. So we have:

Thank you. I could understand better.

Many of testing-frameworks use the template pattern
and have their own base-class (not an interface) to be inherited.
As Java doesn't support multiple inheritance, I think it is better
to have separated utility class which provides services
currently provided by your MyBaseTestCase class
so that you can utilize such service independently of object hierarchy
of its client. By doing so, you could avoid similar issue
when you will try other frameworks, eg. StrutsTestCase.

In article <300a54010707170911m423077f8pe7c69336599f22cd@mail.gmail.com>,
Tue, 17 Jul 2007 11:11:25 -0500,
"Jay Baker" <jbaker.work@gmail.com> wrote: 
jbaker.work> It seems that I have four choices.
jbaker.work> 4. Change the design of existing code base that I have so this is not an
jbaker.work> issue. I can't really afford to do this at this time due to the effort and
jbaker.work> risk involved.

If I were you, I would take this approach.
To minimize the risk you are worrying about, you would change only codes
that relate to Cactus for this time.
# I suggest step-by-step refactoring.

Best Regards,
Kazuhito SUGURI

View raw message