Re: class hierarchy and extending a Cactus Test Case

"Jay Baker" <[email protected]>
Newsgroups gmane.comp.jakarta.cactus.user
Message-ID <[email protected]>
Thank you for your interest. Let's say that I have a base class that is used
for regular (not in container) test cases. Call this MyBaseTestCase. I have
other test classes that extend this base class. The base class provides
services that I need and the current design uses inheritance. For example,
it uses a template pattern approach to enforce that some metadata is
available. So we have:

public class TestCase03 extends MyBaseTestCase {
... }

Now I want to add in container testing using Cactus. I could do:

public class TestCase04 extends ServletTestCase {
... }

but I don't want to because of the existing hierarchy I have.

So I tried:

public class TestCase04 extends MyBaseTestCase implements CactusTestCase {
...}

and delegated to an instance of ServletTestCase for the implementation of
the CactusTestCase interface. That did not work however. To check things
out, I created my own class MyCactusBaseTestCase that looks very much like
ServletTestCase but it extends MyBaseTestCase. This works, but I would
prefer to not rely on the source code of ServletTestCase.

I hope that clarifies things a bit and thanks for your help.

-- Jay

On 7/18/07, Kazuhito SUGURI <[email protected]> wrote:
>
> Hi,
>
> In article <[email protected]>,
> Tue, 17 Jul 2007 11:11:25 -0500,
> "Jay Baker" <[email protected]> wrote:
> jbaker.work> I am using ServletTestCase. Extending this test case works
> just fine. No
> jbaker.work> problem. However, I have an existing object hierarchy that I
> would like to
> jbaker.work> preserve. Although all of the Cactus documentation discusses
> extending one
> jbaker.work> of the Cactus tests, I figured I could just implement some
> appropriate
> jbaker.work> interface(s) and use delegation. As I read further, I
> understood the use of
> jbaker.work> publicly accessible attributes of the various Cactus test
> cases. If this
> jbaker.work> access were done through getters and setters, I would have no
> problem.
>
> I cannot understand what you want to do, so am having questions.
>
> Q1: What is the object for which you want to preserve its object
> hierarchy?
> Q2: What is the relation of the object and Cactus?
> Q3: How should the object and Cactus work together?
>
> A safe example would be helpful.
>
> Best Regards,
> ----
> Kazuhito SUGURI
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.