@Test
public void testGetFlowMappingWhenAgentClassExists() throws FlowMapperException, IOException, NiFiRegistryException {

    final String agentClass = "Class A";
    final VersionedFlow versionedFlow = new VersionedFlow();
    versionedFlow.setName(agentClass);
    versionedFlow.setIdentifier(UUID.randomUUID().toString());
    versionedFlow.setBucketIdentifier(BUCKET_ID);
    when(flowClient.getByBucket(BUCKET_ID)).thenReturn(Collections.singletonList(versionedFlow));
    final Optional<FlowUri> flowUri = flowMapper.getFlowMapping(agentClass);
    assertNotNull(flowUri);
    assertTrue(flowUri.isPresent());
    assertEquals(REGISTRY_URL, flowUri.get().getRegistryUrl());
    assertEquals(BUCKET_ID, flowUri.get().getBucketId());
    assertEquals(versionedFlow.getIdentifier(), flowUri.get().getFlowId());
}