title: Mock Service inside resource using jersey test framwork
body: <p>I have a resource for rest API which uses a service.
  This service has a constructor with parameters. 
  I want to test this resource and to mock this service.
  This <a href="https://stackoverflow.com/questions/21074013/how-to-pass-parameters-to-rest-resource-using-jersey-2-5">Question: How to pass parameters to REST resource using Jersey 2.5</a></p>
  
  <p>wasn't helpful because they used @Inject and I cannot use it.
  Any suggestions?</p>
  
  <p>The second question is how do I pass parameter to test this resouce:
  My code is:</p>
  
  <pre><code>@Path("/2/{subversion: [0-3]}/users")
  public class UserResource {
      Logger log = Logger.getLogger(UserResource.class);
      private MyService service;
      public void setService(Service ser) {
          this.service = ser;
      }
  </code></pre>
  
  <p>@Context HttpServletRequest currentRequest;</p>
  
  <pre><code>@GET
  @Produces("application/json")
  public Response getUsers(@Context HttpHeaders httpHeaders, @Context UriInfo
  uriInfo) {
  // my function
  }
  }
  </code></pre>
  
  <p>How can I pass "httpHeaders" and "UriInfo".
  My test looks like this:</p>
  
  <pre><code>Response response = target("/2/0/users/").request().get();
  Users users = response.readEntity(Users.class);
  assertNotNull(users);
  </code></pre>