resetting a static object?
807588Jun 10 2009 — edited Jun 10 2009Okay I've created an application to create and monitor a number of other applications. My contorller application consists of a main method and a number of static methods and objects. I'm trying to create tests to test the functionality of the application.
The problem I have is it's static. once I run the main method once variables get set, timers started, sockets locked ect. This makes it very difficult to run independent tests as every test after the first already has the application running and changes made to it's static variables. What I would like is at the end of each test the static object acted as if the application was closed: releasing locks it held, resetting variables to default, and calling the onExit method. That way the next test in the suit won't be effected by changes made to static variables in the previous state.
Does anyone know an easy way of doing that? For now I'm calling the my onExit method directly which stops timers and releases sockets, but I still don't feel confident that my tests are running truely independently so long as they are sharing a static object.