logo       

Re: Re: design issue: msg#00197

java.junit.user

Subject: Re: Re: design issue


On 2002-06-26 at 15:31 Boris Garbuzov wrote:

>I found the third solution. Since my "single call
>code" uses no members of my test case, I placed former
>to static area of the latter as shown below. Had the
>code required members, it would have been possible to
>combine all test methods or even just overwrite run()
>method.
>
>---------------------------------
>
>public class AppTest
> extends TestCase
>{
>
> /*
> This is sure to be called once per process on class
>loading.
> */
> static
> {
> webclient.ClientMain.main(null);
> }
>
>==========================================

This is a design smell: static initializers make diagnosing problems
difficult, because they general require JVM shutdown and restart to
reproduce. Avoid them at all costs; use them only when absolutely no
other way could possibly work.

J. B. Rainsberger,
President, Diaspar Software Services
Let's write software that people understand.
http://www.diasparsoftware.com/
telephone: +1 416 791-8603
All correspondence (c) 2002 Diaspar Software Services.
If you want to use it, just ask; don't steal.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise