Unittest to verify that static method is called

.. using PowerMock, Mockito, TestNG

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

  1. mock the showMessageDialog call - because otherwise the test will fail with an java.lang.VerifyError (UIManager is not initialized)
  2. verify that showMessageDialog is called + with the right parameter


Sotograph - Debugging ModelManager

While using the code analysis tool Sotograph you can specify a model of your system in the ModelManager. The specification is written in Java by using the Sotograph API but can also use common Java statements. Sometimes - e.g. when using regex - there is the need to debug your code. To do this you have to possibilities:
  1. Using System.out.println(debug_msg) + starting Sotograph with sotoplatformConsole.bat
  2. Using JOptionPane.showMessageDialog(null, debug_msg) + starting Sotograph as usual