• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • influxdb-plugin
    • None
    • 2.4

      Eg. CustomDataMapPointGeneratorTest and CustomDataPointGeneratorTest fail to compile with

      The method thenReturn(capture#5-of ?) in the type OngoingStubbing<capture#5-of ?> is not applicable for the arguments (Job)

      Apparently the Job mock does not match the expected types.

          [JENKINS-61079] Tests have compilation errors in 2.1

          The fix is actually really simple, just use the type-unsafe doReturn on the Job mock. Like so:

           

                  Mockito.doReturn(job).when(build).getParent();

           

          Don't have the time to go through a pull request myself, unfortunately.

          Eero Nevalainen added a comment - The fix is actually really simple, just use the type-unsafe doReturn on the Job mock. Like so:           Mockito. doReturn (job).when(build).getParent();   Don't have the time to go through a pull request myself, unfortunately.

          Aleksi Simell added a comment -

          cptpicard How are you able to reproduce this? When I run `mvn test` all tests compile and run successfully. I have seen the error in IDE, but nowhere else. I know the workaround, but since it doesn't seem to affect the actual functionality of the tests I haven't done that to all the tests.

          Aleksi Simell added a comment - cptpicard How are you able to reproduce this? When I run `mvn test` all tests compile and run successfully. I have seen the error in IDE, but nowhere else. I know the workaround, but since it doesn't seem to affect the actual functionality of the tests I haven't done that to all the tests.

          Ah, interesting. I specifically try to run the tests in an IDE. Maybe maven and Eclipse use different compiler levels or there is some other "flag" that makes it stricter in the IDE?

           

          Eero Nevalainen added a comment - Ah, interesting. I specifically try to run the tests in an IDE. Maybe maven and Eclipse use different compiler levels or there is some other "flag" that makes it stricter in the IDE?  

          Aleksi Simell added a comment -

          Fixed with this PR

          Aleksi Simell added a comment - Fixed with this PR

            aleksisimell Aleksi Simell
            cptpicard Eero Nevalainen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: