I need to determine whether or not a particular method of a class is called when it receives a kill signal. This method, where it performs some cleanup actions, is called in a shutdown hook.
I tried using EasyMock to expect that this method is called after executing a Process that starts the main method of this class and then call the Process destroy method as part of the test's action, but somehow this class's mock is not connected to the process I launch.
How can I test that a class's method is called upon receiving a shutdown signal? I'd like to do this without having to modify the class's implementation in order to test the class.