honestly i just want to be able to use the assertions and have a way to see if they are right. without changing methods to to test<method name> .
like lets say in my actionlistener i just want to assertNotNull("your top button is null",btnTop);
or if i just want to see if a
string equals something
lets say in the init method i want to make sure a string is the right string.
String red="red";
assertEquals("your red string was set right", red,"red");
whats the easiest way to have these assert methods functioning in order to junit to find them. normally i was under the impresination you need to extend TestCase and start each method with test in order for junit to find it.
I was thinking about making an object that would have the assertmethods i need and just reverse engineering the junit methods (as in re writing the code behind the TestClass class) and embedding that object and making a static method that would run all the tests i populated it with.
I think there must be an easier way to do this care to elaborate? like i couldnt do it the regular way because i cant call my init testinit() for the applets sake. however couldnt i just store all these asserts in an object and then have a testSuite run them or find some other way to do things? thanks
like for this code below say that i just want to see if the color string is red. how would i put the assert in and what else would i have to do? thanks
public class HelloWorldSwing {
private static void createAndShowGUI() {
String color="red";
JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}