Please find in the attached picture the architecture of my unit testings.
Basically, I created two unit test classes which extend and AbstractTest
class which, in turn, extends the JUnit TestCase class.

Both classes retrieve a logger from a class implemented as Singleton
(therefore only one instance should be created). I put a log message in the
the constructor to see how many times the constructor gets invoked (and
actually it is invoked twice while it should be invoked only once as this is
a singleton).

Attached you will find the unit test classes, logger factory and a PDF with
the dump of the unit test activity, showing the message logged from the
Singleton constructor. For simplicity, the diagram doesn't show the package
hierarchy, which is available on request.

If you really want to run the application, you may want to download it and
the logging framework, following the instructions at the following site:

http://www.jemos.org

Best Regards,

Marco

----- Original Message ----- 
From: "Charles Daniels" <    >
To: "Maven-users" <[EMAIL PROTECTED]>
Sent: Tuesday, February 17, 2004 7:21 AM
Subject: Re: Unit testing question


> This sounds more like a problem with the way you have implemented your
unit tests, not a problem
> with Maven.  Can you provide more details on how you have written your
test classes?
>
> --- Marco Tedone <[EMAIL PROTECTED]> wrote:
> > Hi, I build my projects using maven. Maven executes automatically junit
tests. I've got more
> > than one test. Both of those tests use the services offered by a class,
which I've implemented
> > as a Singleton. The class is created after each test class has
completed, thus my singleton is
> > like as it doesn't exist.
> >
> > Is there a solution to this problem?
> >
> > Marco
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to