Recent versions of junit (starting from 4.11) do not bundle hamcrest-core anymore. This is causing java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing in IntelliJ Idea 13.+.

Proposed fix is to check if Hamcrest's class could be found in the same library as JUnit's classes. If not, Hamcrest library should be added to test dependencies along with JUnit.