Skip to content

Commit 9cbe059

Browse files
committed
test: add sleep delays in RoCrateMetadataGenerationTest to ensure stability during crate updates
1 parent eb89c94 commit 9cbe059

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/test/java/edu/kit/datamanager/ro_crate/writer/RoCrateMetadataGenerationTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,22 @@ void should_HaveBidirectionalRelation_Between_RoCrateJavaAndItsAction(@TempDir P
141141
}
142142

143143
@Test
144-
void should_AccumulateActions_When_WritingMultipleTimes(@TempDir Path tempDir) throws IOException {
144+
void should_AccumulateActions_When_WritingMultipleTimes(@TempDir Path tempDir) throws IOException, InterruptedException {
145145
// Create and write crate first time
146146
RoCrate crate = new RoCrate.RoCrateBuilder().build();
147147
validateCrate(crate);
148148

149149
Path outputPath = tempDir.resolve("test-crate");
150150
Writers.newFolderWriter().save(crate, outputPath.toString());
151151
validateCrate(Readers.newFolderReader().readCrate(outputPath.toString()));
152+
Thread.sleep(10);
152153

153154
// Write same crate two more times to simulate updates
154155
Writers.newFolderWriter().save(crate, outputPath.toString());
156+
Thread.sleep(10);
155157
Writers.newFolderWriter().save(crate, outputPath.toString());
156158
validateCrate(Readers.newFolderReader().readCrate(outputPath.toString()));
159+
Thread.sleep(10);
157160

158161
// Read and print metadata for debugging
159162
String metadata = Files.readString(outputPath.resolve("ro-crate-metadata.json"));
@@ -354,18 +357,14 @@ void should_AddProvenanceInfo_When_ModifyingExistingCrateWithoutProvenance(@Temp
354357
}
355358

356359
@Test
357-
void should_PreserveExistingProvenance_When_ModifyingCrate(@TempDir Path tempDir) throws IOException {
360+
void should_PreserveExistingProvenance_When_ModifyingCrate(@TempDir Path tempDir) throws IOException, InterruptedException {
358361
// First create a crate with normal provenance
359362
RoCrate originalCrate = new RoCrate.RoCrateBuilder().build();
360363
validateCrate(originalCrate);
361364

362365
Path outputPath = tempDir.resolve("test-crate");
363366
Writers.newFolderWriter().save(originalCrate, outputPath.toString());
364-
try {
365-
Thread.sleep(10);
366-
} catch (InterruptedException e) {
367-
// ignore
368-
}
367+
Thread.sleep(10);
369368

370369
// Now read and modify the crate
371370
RoCrate modifiedCrate = Readers.newFolderReader().readCrate(outputPath.toString());

0 commit comments

Comments
 (0)