> The most common solution to this problem is using a Factory Method to
> return the correct implementation of the interface.  Your classes should
> never know which implementation is in use because they will all ask the
> Factory Method for the object.  You just need to change the one line in
> the method to return a different object for testing.

Ok, you mean something like that:

Class ConnectionHandlerFactory
        ...

        public IConnectonHandler getConnectonHandler()
        {
                if (test)
                        return new ConnectionHandlerTest();

                else
                        return new ConnectionHandlerForTomcat();


        }

but I think this has 2 problems:

1) in my production code I'll have code that is written just for testing
purpose
2) Before executing any test I have to set the "test" variable to true.


Or I did not understand?


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

Reply via email to