Skip to content

Some tests are failing under Java 21 #1059

Closed
@ryanprayogo

Description

@ryanprayogo

Some tests that are using Mockito are failing under Java 21 with this error

Cannot call abstract real method on java object!
Calling real methods is only possible when mocking non abstract method.

This seem to be caused by an open issue in Mockito.

There is a workaround available (set the net.bytebuddy.experimental system property to true), which can be set in the unit tests' @BeforeAll annotated method.

Steps to reproduce:

  • Use Java 21 (reproducible with Temurin JDK 21.0.4)
  • Run mvn clean test
  • Observe failures

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersjavaPull requests that update Java code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions