@Test(expected = ResourceNotFoundException.class)
public void testUpdateBucketDoesNotExist() {

    final Bucket bucket = new Bucket();
    bucket.setIdentifier("b1");
    bucket.setName("My Bucket");
    bucket.setDescription("This is my bucket.");
    registryService.updateBucket(bucket);
    when(metadataService.getBucketById(any(String.class))).thenReturn(null);
    registryService.updateBucket(bucket);
}