Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8264270

NullPointerException when using matcher on ParameterizedTypeReference

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      os_x

      Description

      A DESCRIPTION OF THE PROBLEM :
      The Java compiler fails with a Null Pointer Exception when attempting to use the org.mockito.ArgumentMatchers.eq function to mock a call. Code example:

      doReturn(responseEntity)
              .when(restTemplate)
              .exchange(
                  anyString(),
                  eq(HttpMethod.POST),
                  any(HttpEntity.class),
                  eq(new ParameterizedTypeReference<>() {}));

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compilation works, or I am given the correct warning about why the code cannot compile
      ACTUAL -
      Compilation process errors out

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            adev ANUPAM DEV
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: