### Question:
IdResource { @GET @Timed @Produces(ProtocolBufferMediaType.APPLICATION_PROTOBUF) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) public SnowizardResponse getIdAsProtobuf( @HeaderParam(HttpHeaders.USER_AGENT) final String agent, @QueryParam("count") final Optional<IntParam> count) { final List<Long> ids = Lists.newArrayList(); if (count.isPresent()) { for (int i = 0; i < count.get().get(); i++) { ids.add(getId(agent)); } } else { ids.add(getId(agent)); } return SnowizardResponse.newBuilder().addAllId(ids).build(); } 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);  }### Answer:
@Test public void testGetIdAsProtobuf() throws Exception { final long id = 100L; when(worker.getId(AGENT)).thenReturn(id); final Response response = resources.client().target("/") .register(new ProtocolBufferMessageBodyProvider()) .request(ProtocolBufferMediaType.APPLICATION_PROTOBUF) .header(HttpHeaders.USER_AGENT, AGENT).get(); final SnowizardResponse actual = response .readEntity(SnowizardResponse.class); final SnowizardResponse expected = SnowizardResponse.newBuilder() .addId(id).build(); assertThat(response.getStatus()).isEqualTo(200); assertThat(actual).isEqualTo(expected); verify(worker).getId(AGENT); }