Fix for NoClassDefFound in IntelliJ Idea 13.+ with JUnit 4.11

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.

Tested on IntelliJ Idea 135.666