title: Capture Entity argument to webtarget.request.put in with mockito
body: <p>I'm trying to capture an argument passed to my webtarget. But IntelliJ keeps telling me it is wrong</p>
  
  <p>aren't you able to capture the Entity.class or am I doing it wrong?</p>
  
  <p>Code snippet</p>
  
  <pre><code>private WebTarget webTarget;
  
  response = target.request("application/hal+json").put(Entity.entity(inputString, MediaType.APPLICATION_JSON_TYPE));
  </code></pre>
  
  <p>My test</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class ConnectorClientTest {
  
      @Mock
      WebTarget webTarget;
  
      @Mock
      Invocation.Builder builder;
  
      @InjectMocks
      ConnectorClient connectorClient;
  
  
      @Before
      public void setUp() throws Exception {
          Response response = null;
          when(webTarget.path(any())).thenReturn(webTarget);
          when(webTarget.path(any())).thenReturn(webTarget);
          when(webTarget.request(anyString())).thenReturn(builder);
          when(builder.put(any(Entity.class)))
              .thenReturn(response);
      }
  
          @Test
          public void initiatePropertyIdentifierSearchTest(){
  
          PropertyIdentifierSearchInput input = new 
          PropertyIdentifierSearchInput("12345670", BigInteger.valueOf(123));
  
          connectorClient.initiatePropertyIdentifierSearch(input);
          ArgumentCaptor&lt;Entity&gt; argument = ArgumentCaptor.forClass(Entity.class);
          verify(webTarget.request((String[]) 
          Mockito.any()).put(argument.capture()));
          Entity entity = argument.getValue();
          //assert the entity
  
  
      }
  </code></pre>