@Test
public void testGetDiffReturnsChangesInChronologicalOrder() {

    when(flowPersistenceProvider.getFlowContent(
            anyString(), anyString(), anyInt()
    )).thenReturn(new byte[10], new byte[10]);
    final VersionedProcessGroup pgA = createVersionedProcessGroupA();
    final VersionedProcessGroup pgB = createVersionedProcessGroupB();
    when(flowContentSerializer.readDataModelVersion(any(InputStream.class))).thenReturn(2);
    when(flowContentSerializer.isProcessGroupVersion(eq(2))).thenReturn(true);
    when(flowContentSerializer.deserializeProcessGroup(eq(2),any())).thenReturn(pgA, pgB);
    // getFlowDiff orders the changes in ascending order of version number regardless of param order
    final VersionedFlowDifference diff = registryService.getFlowDiff(
            "bucketIdentifier", "flowIdentifier", 2,1);
    assertNotNull(diff);
    Optional<ComponentDifferenceGroup> nameChangedComponent = diff.getComponentDifferenceGroups().stream()
            .filter(p->p.getComponentId().equals("ProcessorFirstV1")).findFirst();
    assertTrue(nameChangedComponent.isPresent());
    ComponentDifference nameChangeDifference = nameChangedComponent.get().getDifferences().stream()
            .filter(d-> d.getDifferenceType().equals("NAME_CHANGED")).findFirst().get();
    assertEquals("ProcessorFirstV1", nameChangeDifference.getValueA());
    assertEquals("ProcessorFirstV2", nameChangeDifference.getValueB());
}