mercredi 29 mars 2017

How to create a test which waits for record appearance in the database?

I have a method which starts generating some report in another thread while the main thread returns a link to a google folder where created report should be uploaded. After report was created, it inserts a record with some information in the database.

public Link startReportCreation(ReportRequest reportRequest) {
    Link link = /** some logic **/;
    taskExecutor.execute(() -> {
        /** report creation logic **/
    });
    return link;

So what is the best way to test the info of the inserted record without modifying the startReportCreation method? Does the scheduled lookup is the only approach here?

Aucun commentaire:

Enregistrer un commentaire