Hi group.
Just wondered... how to write a unit test for something like:
public void fatal(Exception x) {
x.printStackTrace();
if (x instanceof DAException)
JOptionPane.showMessageDialog(null, "Database error. Only barfing ist left..");
System.exit(1);
}
Ciao, Imi.
Andrew McDonagh - 04 Jan 2005 14:11 GMT
> Hi group.
>
[quoted text clipped - 8 lines]
>
> Ciao, Imi.
in a short answer...mock objects..
A mock dialog so you can test the correct error message was provided and
that the .showMessageDialog() method was called.
A mock System object that you can test that its mock exit() method was
called.
Andrew