@Test
public void shouldPostOrderAndGetItBack() throws Exception {

  OrderBean bean = new OrderBean(id(1L), 2L, OrderState.CREATED, Product.JUMPERS, 10, 100d);
  final Client client = ClientBuilder.newClient();
  //Given a rest service
  rest = new OrdersService(new HostInfo("localhost", port));
  rest.start(CLUSTER.bootstrapServers());
  //When we POST an order
  Response response = client.target(paths.urlPost())
      .request(APPLICATION_JSON_TYPE)
      .post(Entity.json(bean));
  //Then
  assertThat(response.getStatus()).isEqualTo(HttpURLConnection.HTTP_CREATED);
  //When GET the bean back via it's location
  OrderBean returnedBean = client.target(response.getLocation())
      .queryParam("timeout", MIN / 2)
      .request(APPLICATION_JSON_TYPE)
      .get(new GenericType<OrderBean>() {
      });
  //Then it should be the bean we PUT
  assertThat(returnedBean).isEqualTo(bean);
  //When GET the bean back explicitly
  returnedBean = client.target(paths.urlGet(1))
      .queryParam("timeout", MIN / 2)
      .request(APPLICATION_JSON_TYPE)
      .get(new GenericType<OrderBean>() {
      });
  //Then it should be the bean we PUT
  assertThat(returnedBean).isEqualTo(bean);
}