@Test
public void testCreateBucketValid() {

    final Bucket bucket = new Bucket();
    bucket.setIdentifier("1");
    bucket.setName("My Bucket");
    bucket.setDescription("This is my bucket.");
    when(metadataService.getBucketsByName(bucket.getName())).thenReturn(Collections.emptyList());
    doAnswer(createBucketAnswer()).when(metadataService).createBucket(any(BucketEntity.class));
    final Bucket createdBucket = registryService.createBucket(bucket);
    assertNotNull(createdBucket);
    assertNotNull(createdBucket.getIdentifier());
    assertNotNull(createdBucket.getCreatedTimestamp());
    assertEquals(bucket.getIdentifier(), createdBucket.getIdentifier());
    assertEquals(bucket.getName(), createdBucket.getName());
    assertEquals(bucket.getDescription(), createdBucket.getDescription());
}