title: Mockito always return null when testing dropwizard resources
body: <p>I am trying to test dropwizard resources and followed <a href="http://www.dropwizard.io/manual/testing.html" rel="nofollow">http://www.dropwizard.io/manual/testing.html</a> to do so.</p>
  
  <p>However, I always get a null object from the mocked class/method.</p>
  
  <p><strong>The resource method</strong> </p>
  
  <pre><code>    @GET
      @Path("/id")
      @ApiOperation("Find property by id")
      @Produces(MediaType.APPLICATION_JSON)
      public Property findById(@QueryParam("id") int id) {
  
          return propertyDAO.findById(id);
      }
  </code></pre>
  
  <p><strong>And the test class</strong></p>
  
  <pre><code>public class PropertiesResourceTest {
  
      private static final PropertiesDAO dao = mock(PropertiesDAO.class);
  
      @ClassRule
      public static final ResourceTestRule resources = ResourceTestRule.builder()
              .addResource(new PropertiesResource(dao))
              .build();
  
      private final Property property = new Property(1);
  
      @Before
      public void setUp() {
  
          when(dao.findById(eq(1))).thenReturn(property);
          reset(dao);
      }
  
      @Test
      public void findById() {
          assertThat(resources.client().target("/properties/id?id=1").request().get(Property.class))
                  .isEqualTo(property);
          verify(dao).findById(1);
      }
  
  }
  </code></pre>
  
  <p>I tried to spin it in many ways, but the result is always the same:</p>
  
  <pre><code>expected:&lt;Property | ID: 1 &gt; but was:&lt;null&gt;
  </code></pre>
  
  <p>Do you have any leads on why mockito is always returning a null object ? </p>