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

    when(metadataService.getBucketById(any(String.class))).thenReturn(null);
    final VersionedFlow versionedFlow = new VersionedFlow();
    versionedFlow.setIdentifier("f1");
    versionedFlow.setName("My Flow");
    versionedFlow.setBucketIdentifier("b1");
    registryService.createFlow(versionedFlow.getBucketIdentifier(), versionedFlow);
}