@Test
public void testCreateConsumerGroup() throws Exception {

    CreateConsumerGroupRequest request = new CreateConsumerGroupRequest();
    final String destination = "/foo/bar";
    final String consumerGroup = "/test/group";
    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);
    ConsumerGroupDescription response = client.createConsumerGroup(request);
    // Simple test case of creating a ConsumerGroup with path and group name
    assert (response.getDestinationPath().equals(destination));
    assert (response.getConsumerGroupName().equals(consumerGroup));
    // Client should not be able to create a duplicate ConsumerGroup
    thrown.expect(EntityAlreadyExistsError.class);
    client.createConsumerGroup(request);
}