@Test public void testGetIdAsJSON() throws Exception { final long id = 100L; when(worker.getId(AGENT)).thenReturn(id); final Id actual = resources.client().target("/") .request(MediaType.APPLICATION_JSON) .header(HttpHeaders.USER_AGENT, AGENT).get(Id.class); final Id expected = new Id(id); assertThat(actual).isEqualTo(expected); verify(worker).getId(AGENT); }
@GET @Timed @JSONP(callback = "callback", queryParam = "callback") @Produces({ MediaType.APPLICATION_JSON, MediaTypeAdditional.APPLICATION_JAVASCRIPT }) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public Id getIdAsJSON( @HeaderParam(HttpHeaders.USER_AGENT) final String agent) { return new Id(getId(agent)); }
IdResource { @GET @Timed @JSONP(callback = "callback", queryParam = "callback") @Produces({ MediaType.APPLICATION_JSON, MediaTypeAdditional.APPLICATION_JAVASCRIPT }) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public Id getIdAsJSON( @HeaderParam(HttpHeaders.USER_AGENT) final String agent) { return new Id(getId(agent)); } }
IdResource { @GET @Timed @JSONP(callback = "callback", queryParam = "callback") @Produces({ MediaType.APPLICATION_JSON, MediaTypeAdditional.APPLICATION_JAVASCRIPT }) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public Id getIdAsJSON( @HeaderParam(HttpHeaders.USER_AGENT) final String agent) { return new Id(getId(agent)); } IdResource(final IdWorker worker); }
IdResource { @GET @Timed @JSONP(callback = "callback", queryParam = "callback") @Produces({ MediaType.APPLICATION_JSON, MediaTypeAdditional.APPLICATION_JAVASCRIPT }) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public Id getIdAsJSON( @HeaderParam(HttpHeaders.USER_AGENT) final String agent) { return new Id(getId(agent)); } IdResource(final IdWorker worker); long getId(final String agent); @GET @Timed @Produces(MediaType.TEXT_PLAIN) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) String getIdAsString(
            @HeaderParam(HttpHeaders.USER_AGENT) final String agent); @GET @Timed @JSONP(callback = "callback", queryParam = "callback") @Produces({ MediaType.APPLICATION_JSON, MediaTypeAdditional.APPLICATION_JAVASCRIPT }) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) Id getIdAsJSON(
            @HeaderParam(HttpHeaders.USER_AGENT) final String agent); @GET @Timed @Produces(ProtocolBufferMediaType.APPLICATION_PROTOBUF) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) SnowizardResponse getIdAsProtobuf(
            @HeaderParam(HttpHeaders.USER_AGENT) final String agent,
            @QueryParam("count") final Optional<IntParam> count); }
IdResource { @GET @Timed @JSONP(callback = "callback", queryParam = "callback") @Produces({ MediaType.APPLICATION_JSON, MediaTypeAdditional.APPLICATION_JAVASCRIPT }) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public Id getIdAsJSON( @HeaderParam(HttpHeaders.USER_AGENT) final String agent) { return new Id(getId(agent)); } IdResource(final IdWorker worker); long getId(final String agent); @GET @Timed @Produces(MediaType.TEXT_PLAIN) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) String getIdAsString(
            @HeaderParam(HttpHeaders.USER_AGENT) final String agent); @GET @Timed @JSONP(callback = "callback", queryParam = "callback") @Produces({ MediaType.APPLICATION_JSON, MediaTypeAdditional.APPLICATION_JAVASCRIPT }) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) Id getIdAsJSON(
            @HeaderParam(HttpHeaders.USER_AGENT) final String agent); @GET @Timed @Produces(ProtocolBufferMediaType.APPLICATION_PROTOBUF) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) SnowizardResponse getIdAsProtobuf(
            @HeaderParam(HttpHeaders.USER_AGENT) final String agent,
            @QueryParam("count") final Optional<IntParam> count);  }