@Test
public void testUpdateConsumerGroup() throws Exception {

    //Create a ConsumerGroup to update
    CreateConsumerGroupRequest request = new CreateConsumerGroupRequest();
    final String destination = "/foo/bar";
    final String consumerGroup = "TestConsumerGroup";
    final int lockTimeout = new Random().nextInt();
    final int maxDelivery = new Random().nextInt();
    final String email = "foo@bar.com";
    final int skipOlder = new Random().nextInt();
    final long timestamp = new Date().getTime();
    request.setDestinationPath(destination);
    request.setConsumerGroupName(consumerGroup);
    request.setLockTimeoutInSeconds(lockTimeout);
    request.setMaxDeliveryCount(maxDelivery);
    request.setOwnerEmail(email);
    request.setSkipOlderMessagesInSeconds(skipOlder);
    request.setStartFrom(timestamp);
    client.createConsumerGroup(request);
    //Update the path of a group with name consumerGroup
    UpdateConsumerGroupRequest updateRequest = new UpdateConsumerGroupRequest();
    final String newDest = "/new/path/";
    updateRequest.setConsumerGroupName(consumerGroup);
    updateRequest.setDestinationPath(newDest);
    updateRequest.setOwnerEmail(email);
    updateRequest.setMaxDeliveryCount(maxDelivery);
    updateRequest.setLockTimeoutInSeconds(lockTimeout);
    updateRequest.setSkipOlderMessagesInSeconds(skipOlder);
    updateRequest.setStatus(ConsumerGroupStatus.ENABLED);
    ConsumerGroupDescription response = client.updateConsumerGroup(updateRequest);
    //Simple test case of updating an existing ConsumerGroup
    assert (response.getDestinationPath().equals(newDest));
    assert (response.getConsumerGroupName().equals(consumerGroup));
    ReadConsumerGroupRequest readRequest = new ReadConsumerGroupRequest();
    readRequest.setConsumerGroupName(consumerGroup);
    readRequest.setDestinationPath(newDest);
    ConsumerGroupDescription result = client.readConsumerGroup(readRequest);
    //Read the consumer group to make sure server actually updated
    assert (result.getDestinationPath().equals(newDest));
    assert (result.getConsumerGroupName().equals(consumerGroup));
    //Client should not be able to update a nonexistent ConsumerGroup
    thrown.expect(EntityNotExistsError.class);
    updateRequest.setConsumerGroupName("invalidGroup");
    client.updateConsumerGroup(updateRequest);
}