Re: testing methods



On Sun, 30 Oct 2005 01:01:01 GMT, "Michael" <mbialowas@xxxxxxx> wrote,
quoted or indirectly quoted someone who said :

>Hello all, I was wondering something. I am putting 4 methods into a class
>called MyUtils. Can I test these methods to make sure they work; if I create
>new new class files calling these methods. My question is , should it work
>if I place all files in same directory.

In a simple case, your test method can be the main method of the class
you are testing with the body of the method enclosed in:
if ( DEBUGGING )
where DEBUGGING is a static final boolean. This code has a dual
purpose of exercising the methods and showing some sample uses and
expected outputs.

For more complex classes, you use a tool like Junit.

See http://mindprod.com/jgloss/testing.html


--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.