@Test
public void testUpdate() throws Exception {

  JerseyClient client = createClient();
  String featureKey = "testUpdateFeatureKey";
  Feature feature = buildTestFeature(seedGroupOneKey, featureKey);
  String featureJson = Protobuf3Support.toJsonString(feature);
  String url = createFeatureUrl() + "/" + seedGroupOneKey;
  // create a feature
  Response register = client.target(url)
      .request()
      // create using a service's access
      .property(HTTP_AUTHENTICATION_BASIC_USERNAME, seedServiceOne + "/service")
      .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, basicPassword)
      .post(Entity.entity(featureJson, MediaType.APPLICATION_JSON_TYPE));
  assertTrue(register.getStatus() == 201);
  String jsonRegister = register.readEntity(String.class);
  Feature.Builder builderRegister = Feature.newBuilder();
  JsonFormat.parser().merge(jsonRegister, builderRegister);
  // check our result
  String id = builderRegister.getId();
  String created = builderRegister.getCreated();
  String updated = builderRegister.getUpdated();
  Status state = builderRegister.getStatus();
  // same id
  assertNotNull(id);
  // updated
  assertNotNull(updated);
  // created
  assertNotNull(created);
  // disabled by default
  assertEquals(Status.off, state);
  // turn on our feature and send an update
  Feature update = builderRegister.build().toBuilder().setStatus(Status.on).build();
  String featureUpdateJson = Protobuf3Support.toJsonString(update);
  Response responseUpdate = client.target(url + "/" + featureKey)
      .request()
      // this time update using a member
      .property(HTTP_AUTHENTICATION_BASIC_USERNAME, seedMemberOne + "/member")
      .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, basicPassword)
      .post(Entity.entity(featureUpdateJson, MediaType.APPLICATION_JSON_TYPE));
  // check our update result
  assertTrue(responseUpdate.getStatus() == 200);
  String jsonUpdateResult = responseUpdate.readEntity(String.class);
  Feature.Builder builderUpdated = Feature.newBuilder();
  JsonFormat.parser().merge(jsonUpdateResult, builderUpdated);
  // same id
  assertEquals(id, builderUpdated.getId());
  // updated changed from create
  assertNotEquals(updated, builderUpdated.getUpdated());
  // same created
  assertEquals(created, builderUpdated.getCreated());
  // updated to enabled
  assertEquals(Status.on, builderUpdated.getStatus());
  // now read it back from the server and double check
  Response responseGet = client.target(url + "/" + featureKey)
      .request()
      // ask using a service's grant
      .property(HTTP_AUTHENTICATION_BASIC_USERNAME, seedServiceOne + "/service")
      .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, basicPassword)
      .get();
  String jsonResponseGet = responseGet.readEntity(String.class);
  Feature.Builder responseGetBuilder = Feature.newBuilder();
  JsonFormat.parser().merge(jsonResponseGet, responseGetBuilder);
  Feature featResponseGet = responseGetBuilder.build();
  assertEquals(id, featResponseGet.getId());
  // same id
  assertEquals(id, featResponseGet.getId());
  // updated changed from create
  assertNotEquals(updated, featResponseGet.getUpdated());
  // updated sames as last update
  assertEquals(builderUpdated.getUpdated(), featResponseGet.getUpdated());
  // same created
  assertEquals(created, featResponseGet.getCreated());
  // still enabled
  assertEquals(Status.on, featResponseGet.getStatus());
}