Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72251

Can't test with Java 21 because of Powermock

XMLWordPrintable

      Java 21 was released Sep 19, 2023. We would like the most used plugins to be compiled and tested with Java 21.

      The acceptance test harness and plugin bill of materials tests are already passing with Java 21. This is a further step to improve plugin readiness for use with Java 21 and for development with Java 21.

      This plugin uses Powermock for its tests.
      I've made a few updates to get the plugins to compile with JDK21 inĀ my fork.

      Unfortunately, I still get a lot of these errors:

      [ERROR]   symbol:   method anyCollectionOf(java.lang.Class<com.amazonaws.services.cloudformation.model.Parameter>)
      [ERROR]   location: class org.mockito.Mockito
      [ERROR] /home/ubuntu/pipeline-aws-plugin/src/test/java/de/taimos/pipeline/aws/cloudformation/CFNCreateChangeSetTests.java:[222,170] cannot find symbol
      [ERROR]   symbol:   method anyCollectionOf(java.lang.Class<com.amazonaws.services.cloudformation.model.Tag>)
      [ERROR]   location: class org.mockito.Mockito
      [ERROR] /home/ubuntu/pipeline-aws-plugin/src/test/java/de/taimos/pipeline/aws/cloudformation/CFNCreateChangeSetTests.java:[223,107] cannot find symbol
      [ERROR]   symbol:   method anyCollectionOf(java.lang.Class<java.lang.String>)
      [ERROR]   location: class org.mockito.Mockito
      [ERROR] /home/ubuntu/pipeline-aws-plugin/src/test/java/de/taimos/pipeline/aws/cloudformation/CFNDeleteStackTests.java:[62,89] cannot find symbol
      [ERROR]   symbol:   method anyVararg()
      [ERROR]   location: class org.mockito.Mockito
      
      

      Would it be possible to migrate this plugin to Mockito only, instead of Powermock?
      See https://github.com/powermock/powermock/issues/1109#issuecomment-1379680257 "You want to hear, but we upgraded Mockito to 4.0.0 and stopped using PowerMock altogether because Mockito allows to mock static methods since 3.4.0, which was the only reason we used PowerMock."

      Is that the case with this plugin?

      I tried the OpenRewrite recipe, but it failed with another error.

      Could basil please have a quick look?

      Thanks.

            zbynek Zbynek Konecny
            poddingue Bruno Verachten
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: