The import org.hamcrest.Matchers.hasProperty
cannot be resolved in JUnit4.12.
What is the alternative to use hasProperty
?
Hamcrest is not embedded in JUnit 4.12, instead you'll need to include the separate Hamcrest library on your classpath.
If you are using Maven you can do this by including the following dependency in your pom.xml
:
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
Alternatively you can download the JAR from Maven Central.