title: Unit testing jersey Restful Services
body: <p>I'm new to unit testing and I want to test some jersey services in a project. We are using Junit. Please guide me to write test cases in better way.</p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>    @GET
      @Path("/getProducts/{companyID}/{companyName}/{date}")
      @Produces(MediaType.APPLICATION_JSON)
      public Object getProducts(@PathParam("companyID") final int companyID,
              @PathParam("date") final String date, @PathParam("companyName") final String companyName)
              throws IOException {
          return productService.getProducts(companyID, companyName, date);
      }
  </code></pre>
  
  <p>Above mentioned service is working fine and I want to write junit test case to test above mentioned method. Above method will retrieve list of products (<code>List&lt;Product&gt;</code>) in JSON format. I would like to write test case to check response status and json format.</p>
  
  <p><strong>NOTE:</strong> We are using Jersey 1.17.1 version.</p>
  
  <p>Help would be appreciated :)</p>