@Test
public void testRefreshWhenSameVersionFound() throws FlowRetrievalException, FlowMapperException, SerializerException, FlowTransformException, IOException {

    final String className = "Test Class";
    final AtomicInteger refreshedCounter = new AtomicInteger(0);
    final FlowUri flowUri = new FlowUri("http://localhost:18080", "1234", "5678");
    when(flowMapper.getFlowMapping(className)).thenReturn(Optional.of(flowUri));
    final Integer flowVersion = new Integer(1);
    final VersionedFlowSnapshot flowSnapshot = FlowTestUtils.createSnapshot(flowUri.getBucketId(), flowUri.getFlowId(), flowVersion);
    when(flowRetrievalService.getLatestFlow(flowUri)).thenReturn(flowSnapshot);
    final FlowMappingEntity flowMappingEntity = FlowTestUtils.createFlowMappingEntity(className, flowUri, flowVersion, "YAML");
    when(flowMappingRepository.findById(className)).thenReturn(Optional.of(flowMappingEntity));
    // test the refresher
    flowRefresherTask.refreshAgentClass(className, refreshedCounter);
    // no refresh should have happened because already on version 1
    assertEquals(0, refreshedCounter.get());
}