@Test
public void testGetExistingBucket() {

    final BucketEntity existingBucket = new BucketEntity();
    existingBucket.setId("b1");
    existingBucket.setName("My Bucket");
    existingBucket.setDescription("This is my bucket");
    existingBucket.setCreated(new Date());
    when(metadataService.getBucketById(existingBucket.getId())).thenReturn(existingBucket);
    final Bucket bucket = registryService.getBucket(existingBucket.getId());
    assertNotNull(bucket);
    assertEquals(existingBucket.getId(), bucket.getIdentifier());
    assertEquals(existingBucket.getName(), bucket.getName());
    assertEquals(existingBucket.getDescription(), bucket.getDescription());
    assertEquals(existingBucket.getCreated().getTime(), bucket.getCreatedTimestamp());
}