test class

We learned about creating a tester class tonight and I am a little confused.Can any point me in the direction of a good tutorial on creating a test class or some good working examples?~Will
[210 byte] By [grjmmr1a] at [2007-11-26 22:20:56]
# 1

You need help on this kind of material?

public class Test

{

public static void main(String[]args)

{

System.out.println("Welcome to java");

}

}

if not give me an example.

Progr@mera at 2007-7-10 11:18:18 > top of Java-index,Java Essentials,New To Java...
# 2

I created a class Alpha and wrote code for it. I now need to write a tester class (which i assume will be called AlphaTest) that will test the Alpha class by supplying a random number as the arguement to the constructor. In theory I understand what it is asking me but i am not sure how to create this test class.

~Will

grjmmr1a at 2007-7-10 11:18:18 > top of Java-index,Java Essentials,New To Java...
# 3

class AlphaTester {

public static void main(String[] args) {

Alpha alpha = new Alpha();

alpha.method1();

System.out.println(alpha.method2());

}

}

Basically write code that tests if all methods work as per specifications.

floundera at 2007-7-10 11:18:18 > top of Java-index,Java Essentials,New To Java...
# 4

If u want to test the constructor with one argument,

class Alpha{

public Alpha(int x) {

System.out.println("This is constructor with 1 arg");

}

}

class AlphaTester {

public static void main(String[] args) {

Alpha alpha = new Alpha(1);

}

}

kalyani_bhadekara at 2007-7-10 11:18:18 > top of Java-index,Java Essentials,New To Java...