@Test
public void testCreateFlow() {

    final String agentClassFoo = "Class FOO";
    final NiFiUser user = new StandardNiFiUser.Builder().identity("system").build();
    final FDFlowMetadata flowMetadata = flowManager.createFlow(agentClassFoo, user);
    entityManager.flush();
    assertEquals(agentClassFoo, flowMetadata.getAgentClass());
    assertNotNull(flowMetadata.getIdentifier());
    assertNotNull(flowMetadata.getCreated());
    assertNotNull(flowMetadata.getUpdated());
    final Optional<FDFlow> flowOptional = flowManager.getFlow(flowMetadata.getIdentifier());
    assertTrue(flowOptional.isPresent());
    final FDFlow flow = flowOptional.get();
    assertEquals(flowMetadata.getIdentifier(), flow.getFlowMetadata().getIdentifier());
    assertNotNull(flow.getFlowContent());
    assertNotNull(flow.getFlowContent().getIdentifier());
    assertNotNull(flow.getFlowContent().getName());
}