In example the class under test (cut) has a method showErrorMessage(msg). This method will call the static method JOptionPane.showMessageDialog(...) to show a error message.
I wrote a unittest to
- mock the showMessageDialog call - because otherwise the test will fail with an java.lang.VerifyError (UIManager is not initialized)
- verify that showMessageDialog is called + with the right parameter