JsonResource { @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public TestBean roundTrip(TestBean s) { return s; }  @GET @Produces(MediaType.APPLICATION_JSON) TestBean createSimpleBean(); @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) TestBean roundTrip(TestBean s);  }
@Test public void roundTripTest() { final WebTarget target = target("test"); final TestBean testBean = target .request(MediaType.APPLICATION_JSON_TYPE) .post(Entity.entity(new TestBean("a", 1, 1L), MediaType.APPLICATION_JSON_TYPE), TestBean.class); assertEquals(testBean, new TestBean("a", 1, 1L)); }