private void runEndToEndTest() throws IOException {
    DigitalDocumentWrapper wrapper =
        new DigitalDocumentWrapper(
            new DtpDigitalDocument("bar.txt", null, "text/plain"), "text/plain", "bartxt");

    BlobbyStorageContainerResource rootPre =
        new BlobbyStorageContainerResource(
            "Test Root", "root", Collections.emptyList(), Collections.emptyList());

    BlobbyStorageContainerResource root =
        new BlobbyStorageContainerResource(
            "Test Root",
            "root",
            Collections.emptyList(),
            List.of(
                new BlobbyStorageContainerResource(
                    "Folder 1.1", "1.1", Collections.emptyList(), Collections.emptyList()),
                new BlobbyStorageContainerResource(
                    "Folder 1.2", "1.2", Collections.emptyList(), Collections.emptyList())));

    BlobbyStorageContainerResource folder1_1 =
        new BlobbyStorageContainerResource(
            "Folder 1.1",
            "1.1",
            Collections.emptyList(),
            List.of(
                new BlobbyStorageContainerResource(
                    "Folder 1.1.1", "1.1.1", Collections.emptyList(), Collections.emptyList()),
                new BlobbyStorageContainerResource(
                    "Folder 1.1.2", "1.1.2", Collections.emptyList(), Collections.emptyList())));

    BlobbyStorageContainerResource folder1_2 =
        new BlobbyStorageContainerResource(
            "Folder 1.2", "1.2", List.of(wrapper), Collections.emptyList());

    BlobbyStorageContainerResource folder1_1_1 =
        new BlobbyStorageContainerResource(
            "Folder 1.1.1", "1.1.1", List.of(wrapper), Collections.emptyList());

    BlobbyStorageContainerResource folder1_1_2 =
        new BlobbyStorageContainerResource(
            "Folder 1.1.2", "1.1.2", List.of(wrapper), Collections.emptyList());
    
    // To simulate restart
    blobbySerializer = new BlobbySerializer(jobStore);
    List<ImportableData<ExportData>> data = Lists.newArrayList(blobbySerializer.serialize(rootPre));
    assertEquals(1, data.size());
    assertEquals("/Test Root", data.get(0).getName());
    
    // To simulate restart
    blobbySerializer = new BlobbySerializer(jobStore);
    data = Lists.newArrayList(blobbySerializer.serialize(root));
    assertEquals(3, data.size());
    assertEquals("/Test Root", data.get(0).getName());
    assertEquals("/Test Root/Folder 1.1", data.get(1).getName());
    assertEquals("/Test Root/Folder 1.2", data.get(2).getName());
    
    // To simulate restart
    blobbySerializer = new BlobbySerializer(jobStore);
    data = Lists.newArrayList(blobbySerializer.serialize(folder1_1));
    assertEquals(3, data.size());
    assertEquals("/Test Root/Folder 1.1", data.get(0).getName());
    assertEquals("/Test Root/Folder 1.1/Folder 1.1.1", data.get(1).getName());
    assertEquals("/Test Root/Folder 1.1/Folder 1.1.2", data.get(2).getName());
    
    // To simulate restart
    blobbySerializer = new BlobbySerializer(jobStore);
    data = Lists.newArrayList(blobbySerializer.serialize(folder1_1_1));
    assertEquals(2, data.size());
    assertEquals("/Test Root/Folder 1.1/Folder 1.1.1", data.get(0).getName());
    assertEquals("bar.txt", data.get(1).getName());
    ImportableFileData fileExportData = (ImportableFileData) data.get(1);
    assertEquals(
        ((FileExportData) fileExportData.getJsonData().getPayload()).getFolder(),
        "/Test Root/Folder 1.1/Folder 1.1.1");
    
    // To simulate restart
    blobbySerializer = new BlobbySerializer(jobStore);
    data = Lists.newArrayList(blobbySerializer.serialize(folder1_1_2));
    assertEquals(2, data.size());
    assertEquals("/Test Root/Folder 1.1/Folder 1.1.2", data.get(0).getName());
    assertEquals("bar.txt", data.get(1).getName());
    fileExportData = (ImportableFileData) data.get(1);
    assertEquals(
        ((FileExportData) fileExportData.getJsonData().getPayload()).getFolder(),
        "/Test Root/Folder 1.1/Folder 1.1.2");
    
    // To simulate restart
    blobbySerializer = new BlobbySerializer(jobStore);
    data = Lists.newArrayList(blobbySerializer.serialize(folder1_2));
    assertEquals(2, data.size());
    assertEquals("/Test Root/Folder 1.2", data.get(0).getName());
    assertEquals("bar.txt", data.get(1).getName());
    fileExportData = (ImportableFileData) data.get(1);
    assertEquals(
        ((FileExportData) fileExportData.getJsonData().getPayload()).getFolder(),
        "/Test Root/Folder 1.2");
  }
Test
Root
 Folder 1.1
   Folder 1.1.1
     bar.txt
   Folder 1.1.2
     bar.txt
  Folder 1.2
   bar.txt
extensions/data-transfer/portability-data-transfer-generic/src/test/java/org/datatransferproject/datatransfer/generic/BlobbySerializerSimulationTest.java