title: java.lang.AssertionError: expected:<200> but was:<404> in jersey restful services unit test
body: <p>I have this class <strong>JerseySpringSuiteTest.java</strong>:</p>
  
  <pre><code>@RunWith(Suite.class)
  @Suite.SuiteClasses({ ProductTest.class })
  public class JerseySpringSuiteTest {
      public static JerseyTest jerseyTest;
  
      @BeforeClass
      public static void init() {
          jerseyTest = new JerseyTest(new WebAppDescriptor.Builder("com.product.resource")
                  .contextParam("contextConfigLocation", "classpath:applicationContext.xml").servletClass(SpringServlet.class)
                  .contextListenerClass(ContextLoaderListener.class).requestListenerClass(RequestContextListener.class).build()) {
  
          };
      }
  }
  </code></pre>
  
  <p>and <strong>ProductTest.java</strong>:</p>
  
  <pre><code>public class ProductTest{
  
      @Before
      public void before() throws Exception {
          JerseySpringSuiteTest.jerseyTest.setUp();
          ExecutorService productExecutorService = ContextLoaderListener.getCurrentWebApplicationContext().getBean(
                  "productExecutorService", ExecutorService.class);
          Assert.assertNotNull(productExecutorService);
      }
  
      @Test
      public void testNoAction() {
          WebResource webResource = JerseySpringSuiteTest.jerseyTest.resource();
          String responseMsg = webResource.path("product/").get(String.class);
          Assert.assertEquals("No Action Specified", responseMsg);
      }
  
      @Test
      public void testGetProducts() throws URISyntaxException {
          WebResource webResource = JerseySpringSuiteTest.jerseyTest.resource().path(
                  "Products/rest/product/getProducts/1/productName/01-01-2013/");
          ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  
          Assert.assertEquals(200, response.getStatus());
      }
  }
  </code></pre>
  
  <p>and <strong>Product.java:</strong></p>
  
  <pre><code>@Component
  @Path("/product")
  public class Product{
      @Autowired
      private ProductService productService;
  
      @GET
      @Produces(MediaType.APPLICATION_JSON)
      public Object noAction() {
          return "No Action Specified";
      }
  
      @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>When I execute it I see:</p>
  
  <pre><code>java.lang.AssertionError: expected:&lt;200&gt; but was:&lt;404&gt;
      at org.junit.Assert.fail(Assert.java:88)
      at org.junit.Assert.failNotEquals(Assert.java:743)
      at org.junit.Assert.assertEquals(Assert.java:118)
      at org.junit.Assert.assertEquals(Assert.java:555)
      at org.junit.Assert.assertEquals(Assert.java:542)
      at com.product.resource.MonitoringEngineResourceTest.testGetProducts(ProductTest.java:27)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.junit.runners.Suite.runChild(Suite.java:127)
      at org.junit.runners.Suite.runChild(Suite.java:26)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  </code></pre>
  
  <p>I am able to get data when I ping URL in browser.</p>
  
  <p>Could some one please help me to get response status as 200 and JSON object?</p>
  
  <p><strong>NOTE:</strong> I am using jersey 1.17.1 version and grizzly2 container.</p>