0

after migrating from junit4 to junit5, for some tests we are getting error like:

java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V

we have the following dependencies in pom:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.7.2</version>
    <scope>test</scope>
</dependency>


<!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
    <version>1.9.5</version>
    <scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/io.grpc/grpc-testing -->
<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-testing</artifactId>
    <version>1.23.0</version>
    <scope>test</scope>
</dependency>

Is it because the grpc dependency os not compatible with junit 5? Please help!!

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
Tanaya Mitra
  • 43
  • 1
  • 7
  • Does this answer your question? [Getting "NoSuchMethodError: org.hamcrest.Matcher.describeMismatch" when running test in IntelliJ 10.5](https://stackoverflow.com/questions/7869711/getting-nosuchmethoderror-org-hamcrest-matcher-describemismatch-when-running) – Martin Zeitler Jan 21 '22 at 10:21
  • In short, replace the deprecated `mockito-all` with `mockito-core`. There may be more issues (...), while only the output of `mvn dependency:tree -Dscope=test` would be relevant. – Martin Zeitler Jan 21 '22 at 10:22

0 Answers0