@Test
public void testGetFlowDirectExists() {

    final BucketEntity existingBucket = new BucketEntity();
    existingBucket.setId("b1");
    existingBucket.setName("My Bucket");
    existingBucket.setDescription("This is my bucket");
    existingBucket.setCreated(new Date());
    final FlowEntity flowEntity = new FlowEntity();
    flowEntity.setId("flow1");
    flowEntity.setName("My Flow");
    flowEntity.setDescription("This is my flow.");
    flowEntity.setCreated(new Date());
    flowEntity.setModified(new Date());
    flowEntity.setBucketId(existingBucket.getId());
    when(metadataService.getFlowByIdWithSnapshotCounts(flowEntity.getId())).thenReturn(flowEntity);
    when(metadataService.getBucketById(existingBucket.getId())).thenReturn(existingBucket);
    final VersionedFlow versionedFlow = registryService.getFlow(flowEntity.getId());
    assertNotNull(versionedFlow);
    assertEquals(flowEntity.getId(), versionedFlow.getIdentifier());
    assertEquals(flowEntity.getName(), versionedFlow.getName());
    assertEquals(flowEntity.getDescription(), versionedFlow.getDescription());
    assertEquals(flowEntity.getBucketId(), versionedFlow.getBucketIdentifier());
    assertEquals(existingBucket.getName(), versionedFlow.getBucketName());
    assertEquals(flowEntity.getCreated().getTime(), versionedFlow.getCreatedTimestamp());
    assertEquals(flowEntity.getModified().getTime(), versionedFlow.getModifiedTimestamp());
}