Skip to content

Commit

Permalink
Calling System.exit breaks junit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyestein committed Oct 10, 2024
1 parent 29d81c0 commit 9d66ef1
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ List<String> readFromFile(File hl7DumpFile) throws IOException {
@Scheduled(fixedRate = Long.MAX_VALUE) // do once only
void readOnceAndQueueScheduled() throws Hl7ParseException, WaveformCollator.CollationException, IOException {
readOnceAndQueue(hl7DumpFile);
// Not sure how to wait for Publisher to finish, so just sleep for a bit
try {
Thread.sleep(10_000);
} catch (InterruptedException e) {
logger.warn("Thread was interrupted", e);
}
System.exit(0);
}

void readOnceAndQueue(File hl7DumpFile) throws Hl7ParseException, WaveformCollator.CollationException, IOException {
Expand All @@ -62,13 +69,6 @@ void readOnceAndQueue(File hl7DumpFile) throws Hl7ParseException, WaveformCollat
logger.info("handled {} messages out of {}", mi + 1, messages.size());
}
}
logger.info("Queued {} HL7 messages from test dump file, now exiting", messages.size());
// Not sure how to wait for Publisher to finish, so just sleep for a bit
try {
Thread.sleep(10_000);
} catch (InterruptedException e) {
logger.warn("Thread was interrupted", e);
}
System.exit(0);
logger.info("Queued {} HL7 messages from test dump file", messages.size());
}
}

0 comments on commit 9d66ef1

Please sign in to comment.