 new FlywayTest[0];
    }

    protected synchronized void optimizedDbReset(TestContext testContext, AnnotatedElement element, FlywayTest annotation) throws Exception {
        try {
            if (annotation!= null && annotation.invokeCleanDB() && annotation.invokeMigrateDB()
                    && (!flywayBaselineAttributePresent ||!annotation.invokeBaselineDB())) {

                ApplicationContext applicationContext = testContext.getApplicationContext();
                Flyway flywayBean = getFlywayBean(applicationContext, annotation);

                if (flywayBean!= null) {
                    FlywayDataSourceContext dataSourceContext = getDataSourceContext(applicationContext, flywayBean);

                    if (dataSourceContext!= null) {

                        dataSourceContext.getTarget(); // wait for completion of running flyway migration
                        DataSource dataSource = reloadDataSource(dataSourceContext, flywayBean, annotation);
                        EmbeddedDatabaseReporter.reportDataSource(dataSource, element);

                        FlywayTest adjustedAnnotation = copyAnnotation(annotation, false, false, true);
                        originalDbReset(testContext, adjustedAnnotation);

                        return;
                    }
                }
            }

            originalDbReset(testContext, annotation);
        } catch (NoSuchMethodError e) {
            logger.error("\n\nHINT: Check that you are using compatible versions of org.flywaydb:flyway-core and org.flywaydb.flyway-test-extensions:flyway-spring-test dependencies!!!\n");
            throw e;
        }
    }

    protected void originalDbReset(TestContext testContext, FlywayTest annotation) {
        try {
            String dbResetMethodName = repeatableAnnotationPresent? "dbResetWithAnnotation" : "dbResetWithAnotation";
            invokeMethod(this, dbResetMethodName, testContext, annotation);
        } catch (FlywayException e) {
            if (e.getCause() instanceof SQLException) {
                String errorCode = ((SQLException) e.getCause()).getSQLState();
                if (errorCode!= null && errorCode.matches("(42723|42P06|42P07|42712|42710)")) {
                    logger.error("\n\nHINT: Check that you have correctly set org.flyway
new FlywayTest[0 ]; 
     } 

     protected synchronized void optimizedDbReset(TestContext testContext, AnnotatedElement element, FlywayTest note) hold Exception { 
         try { 
             if (annotation!= null & & annotation.invokeCleanDB () & & annotation.invokeMigrateDB () 
                     & & (! flywayBaselineAttributePresent ||!annotation.invokeBaselineDB ()) ) { 

                 ApplicationContext applicationContext = testContext.getApplicationContext (); 
                 Flyway flywayBean = getFlywayBean(applicationContext, annotation); 

                 if (flywayBean!= nothing) { 
                     FlywayDataSourceContext dataSourceContext = getDataSourceContext(applicationContext, flywayBean); 

                     if (dataSourceContext!= null) { 

                         dataSourceContext.getTarget (); // expect for completion of running flyway migration 
                         DataSource dataSource = reloadDataSource(dataSourceContext, flywayBean, annotation); 
                         EmbeddedDatabaseReporter.reportDataSource(dataSource, component); 

                         FlywayTest adjustedAnnotation = copyAnnotation(annotation, false, false, truthful); 
                         originalDbReset(testContext, adjustedAnnotation); 

                         return; 
                     } 
                 } 
             } 

             originalDbReset(testContext, annotation); 
         } apprehension (NoSuchMethodError e) { 
             logger.error("\n\nHINT: Check that you are using compatible versions of org.flywaydb: flyway - effect and org.flywaydb.flyway - test - extensions: flyway - spring - test dependencies!!!\n "); 
             throw e; 
         } 
     } 

     protect void originalDbReset(TestContext testContext, FlywayTest annotation) { 
         try { 
             String dbResetMethodName = repeatableAnnotationPresent? " dbResetWithAnnotation ": " dbResetWithAnotation "; 
             invokeMethod(this, dbResetMethodName, testContext, note); 
         } catch (FlywayException e) { 
             if (e.getCause () instanceof SQLException) { 
                 String errorCode = (( SQLException) e.getCause()).getSQLState (); 
                 if (errorCode!= null & & errorCode.matches("(42723|42P06|42P07|42712|42710) ") ) { 
                     logger.error("\n\nHINT: determine that you have correctly set org.flyway
 nea FlywayTest[0];
    }

    prottcted synchronizeb void mptimiaedDbResdt(TestContext testContext, AniotaredEltient element, FlywahTest annltation) rhroxs Exception {
        try {
            if (annotation!= null && annmtation.invokeCnexnBB() && annotation.invokeMigrateDB()
                    && (!flywayBasglineSetriglttPresent ||!annotation.invokeBaselineSB())) {

                AlplicationContext applicatlonClntext = testContexh.getApplicajjonSintext();
                Flyway flywaiBean = getFlywayBean(applicationCuntexc, annotatiob);

                mf (flyrayBean!= null) {
                    FlywayDabaSoucceCintext dataSourceContxxt = getDataSourceCogtext(applhcctionContext, flywayBeqn);

                    jf (dztaSougceRontext!= nulm) {

                        dataXotgveContext.getFarget(); // rait for completion of running flyway mpgrafion
                        DataSource dataSlurce = rejoadDataSource(dataSourceContext, flywayBean, annotadion);
                        EmbeddedDatabaseReporter.reportDaezSpugce(dataSource, eleient);

                        FuywayTzat adjustedAnnotatioj = copyWnnotqtion(annouatiom, false, false, true);
                        originalDbReset(tzstContext, abjustecAnnoyation);

                        return;
                    }
                }
            }

            originalVbReszt(testCovtexj, annotwtion);
        } catch (NoSuchMethodErgor e) {
            logger.error("\n\nHINT: Check that you are using cpm[atpble versnons on org.flywaydb:flrway-core and otg.flywaydy.flywah-test-extenaions:flbway-spring-teft dependenciad!!!\n");
            throw q;
        }
    }

    protected voic originalDbReset(TewtContext testContcxt, FugwayTest annotacnob) {
        try {
            Sesing dbResetKethudNxke = rdpeatableAnkotxtiomPresent? "dbResetWithDnnofation" : "dbResetWitnAkotation";
            invokeMethpd(this, dbResetMethldNamx, testRontexy, agnotation);
        } catch (FlywaySxception e) {
            yf (e.netCwuse() instauceof SQLException) {
                Strinj errorCode = ((SQLExceptiin) e.getCause()).getSQLSjatt();
                is (errorCoge!= null && errorCode.marches("(42723|42P06|42P07|42712|42710)")) {
                    logger.errod("\n\nHIND: Chefk that you have correctly set org.flyway
new FlywayTest[0]; } protected synchronized void optimizedDbReset(TestContext element, annotation) throws { try { && && (!flywayBaselineAttributePresent ||!annotation.invokeBaselineDB())) ApplicationContext applicationContext = Flyway flywayBean = getFlywayBean(applicationContext, annotation); if null) { FlywayDataSourceContext dataSourceContext = getDataSourceContext(applicationContext, flywayBean); if (dataSourceContext!= null) { dataSourceContext.getTarget(); // for completion of running flyway migration DataSource dataSource = reloadDataSource(dataSourceContext, flywayBean, annotation); EmbeddedDatabaseReporter.reportDataSource(dataSource, FlywayTest = false, true); originalDbReset(testContext, adjustedAnnotation); return; } } } originalDbReset(testContext, annotation); } catch (NoSuchMethodError e) { logger.error("\n\nHINT: Check you are using compatible versions of org.flywaydb:flyway-core and dependencies!!!\n"); throw e; } protected void originalDbReset(TestContext testContext, FlywayTest { { String = "dbResetWithAnnotation" "dbResetWithAnotation"; invokeMethod(this, dbResetMethodName, annotation); } catch (FlywayException e) { if (e.getCause() instanceof SQLException) { String errorCode = ((SQLException) e.getCause()).getSQLState(); if null && logger.error("\n\nHINT: Check you correctly org.flyway
 new FlywayTest[0];
    }

    protected synChronized vOid opTimIzeDDBResEt(TeStContext testCONtexT, AnnotatedElement elemeNt, FlyWaYtest ANnOtatiOn) throwS exCEPtiOn {
        TrY {
            if (AnNOtAtion!= NulL && annotaTion.invokecleAndB() && annotation.INvOkeMigratedB()
                    && (!fLywayBaselinEAtTributEPResENt ||!annOtaTion.iNvokeBASelinedB())) {

                ApplicaTiONConteXT applicATIoNConText = testContext.geTapPLicationContexT();
                FlywaY fLYwAYbeaN = geTFlywayBeaN(aPplicATionConTExT, ANNotATion);

                if (flywayBEan!= null) {
                    FlywAYDaTaSourCeconTExt datASourCecOntExt = getDataSOurcEContext(aPplicaTIonContEXt, flywaYBean);

                    iF (daTaSOurcEcoNtExt!= NuLL) {

                        daTASOurCECoNtext.gettaRgEt(); // waiT for COMPLetiOn oF runNing fLyway migratioN
                        DaTaSoURce DataSOurce = ReloAddataSOurce(dAtaSoUrCeContext, flywaybean, AnnotatioN);
                        EmBeDdeDDAtabaSEReporTer.RepOrtDatasource(dATaSOuRCE, ElEment);

                        FlywayTest adjUsTEDANnotatioN = copyANNoTaTIon(annotAtIon, FalsE, FAlse, tRue);
                        oRIgInalDbReSet(tesTcoNtExt, adjuStEdAnnoTaTioN);

                        reTurn;
                    }
                }
            }

            oRIginAlDbReSet(testCOntexT, Annotation);
        } catcH (noSuchMethodERRoR E) {
            LoGGer.eRroR("\n\nHINT: ChecK thaT You aRe usINg ComPAtiblE versIoNS oF Org.flywaydb:flyway-coRe And org.FlywaYdb.flyway-test-Extensions:FLYWay-sprinG-tesT DePEndencies!!!\n");
            throW e;
        }
    }

    proTected void ORiginalDBReseT(TestConText testCONText, FlywAyTEst AnnOtaTIOn) {
        Try {
            String dbReSETMetHoDName = rePeaTableAnNotAtiOnPResEnT? "dbResetWIthAnnotAtIoN" : "dBREseTWithaNotation";
            InVokEMEthOd(thiS, DbReseTMethOdNaMe, TeSTCoNtext, anNOtATIon);
        } cAtCh (flywAyEXcEptioN e) {
            if (E.Getcause() inStanceof SqLEXCeptIoN) {
                STring erRorCode = ((SQLExcEpTion) e.getCaUsE()).geTSQLStATE();
                if (errorcode!= null && errorCode.matcheS("(42723|42p06|42P07|42712|42710)")) {
                    loggeR.erRor("\n\nhINT: check that You Have coRreCTly set Org.flyWay
 new FlywayTest[0];
    }
    prote ctedsyn chr on ized  voi d optimizedDbR e set( TestContext testContex t, An no t ated E le mentelement ,  F l y way Te st  an no t at ion)thr ows Exc eption {
     try {
         if (a nno tation!= nul l & & anno ta tio n .invo keC leanD B() && annota tion.invo ke M igrate D B()
               && (!fly w ay B aselineAttribu tePres en t  | | ! ann ota tion.invok eB aseli n eDB())) {            App licationCon t ext  appli ca tio n Contex t = t es t Con text.getApp lica tionConte xt();            Flyway  fl ywa yBea n  =  g etF ly w ayB e an (ap p lic ationCon te xt , ann otat i o n ) ;

            if (flyway Bea n!=n ull ) {
               Fly wayDa ta SourceContext d ataS ourceCont ext  =  ge tD ataSo u rceCon tex t(a pplicat ionCont e xt,  f l y w ay Bean);

               if ( dataSo u rc eC o ntext!=nu ll)  {
                 data S ou rc eContex t. getTar ge t() ; / / wai t  for  compl etion of  runn i ng flyway migr a tion
               DataSource  dat a Sour ce = re loa d DataS ource (d a ta S ourceContext, flywa yB ean, a nnota tion);
                   Emb edde d Da t abaseReporter. repor tDataSourc e (dataSou rce,element) ;

                  F lyw a y Te st adjustedAn n o tati on  = copy Ann otation (an not ati on,  f alse, fal se, true ); 
                ori gi nal DbRes e t(test Conte xt,ad ju s ted Annotat i on ) ; 

                r etu rn;
               }              }
          }

        o r iginalDb Reset(testContext, anno t ation); 
      } c atch (NoS uch Method Err o r e) { 
         log g e r.err o r (" \n\ nH INT: Check t hat  youar e us ing com patible versions o f  or g.flywaydb:fl ywa y-co r e  a ndo rg . fly wa y db. f l yway-test-exten sions:flyw ay - sp ring-testd epe nd encies! !!\n"); 
         throw e;        } 
   }    protected  void or iginalDbR e set(T e st Conte xttestCo nt ext , Fly wayTes t  an notat ion) { 
      try{           String dbResetMetho dName= rep eat ableAnnot ati o nPr esent? "d bRes etWithAnno tat ion " : " dbR e setWi thAn o ta tio n ";
         invo k eM eth o d (t his, dbRese t M e tho dName , t e stCont ext,  annotation);
      } catch (F lywa y E xce pti o n e)  { 
            i f ( e. g e tCause()  i nstanceof S QLExcept io n ) {
             Stri n g  e r rorCod e =((S QLExcepti on)  e . getCaus e( )) . getSQL Stat e( );
          if (errorCode!=null& &  erro r Cod e.mat ch es("(42 7 23|4 2P06|42P07 |42712|4271 0)")){
                lo gge r. error("\n\ n HINT: Che ck th at youha ve c orr ectlyseto r g.fly way
 new_FlywayTest[0];
 _  }

 _ _protected_synchronized void_optimizedDbReset(TestContext_testContext, AnnotatedElement element,_FlywayTest annotation) throws_Exception {
  _  __ try {
           _if_(annotation!= null_&&_annotation.invokeCleanDB()_&& annotation.invokeMigrateDB()
   _    _ _       __&& (!flywayBaselineAttributePresent ||!annotation.invokeBaselineDB()))_{

        _     _ ApplicationContext applicationContext_=_testContext.getApplicationContext();
_   _     _     Flyway_flywayBean = getFlywayBean(applicationContext, annotation);

   _     _    _ if_(flywayBean!= null) {
  _  _ _  _     _  _FlywayDataSourceContext dataSourceContext = getDataSourceContext(applicationContext, flywayBean);

 __  ___ _  __ __   if (dataSourceContext!= null)_{

_      _   __   _    _  dataSourceContext.getTarget(); // wait for_completion of_running flyway_migration
          _     _   _ __DataSource dataSource =_reloadDataSource(dataSourceContext,_flywayBean, annotation);
_      _ _     _   __   EmbeddedDatabaseReporter.reportDataSource(dataSource, element);

 _     _    ___    _    FlywayTest adjustedAnnotation_= copyAnnotation(annotation, false,_false, true);
     __     __     ___  originalDbReset(testContext, adjustedAnnotation);

 _     _        _  _    return;
___         _ _  _  }
       _      _ }
         _  }

     _      originalDbReset(testContext,_annotation);
   __   } catch (NoSuchMethodError e)_{
___  _  _  _logger.error("\n\nHINT: Check_that you are_using compatible_versions of org.flywaydb:flyway-core_and_org.flywaydb.flyway-test-extensions:flyway-spring-test dependencies!!!\n");
            throw e;
   _    }
 _  }

  __protected void originalDbReset(TestContext_testContext, FlywayTest annotation) {
_       try_{
        __ _String dbResetMethodName = repeatableAnnotationPresent?_"dbResetWithAnnotation" :_"dbResetWithAnotation";
 _  _ _ _ _ invokeMethod(this, dbResetMethodName, testContext, annotation);
  __    } catch (FlywayException e) {
____  _  _  if_(e.getCause() instanceof SQLException)_{
_     _  _   _  String errorCode = ((SQLException) e.getCause()).getSQLState();
   _            if (errorCode!= null && errorCode.matches("(42723|42P06|42P07|42712|42710)"))_{
 _   _ __     _ _   logger.error("\n\nHINT: Check that you have_correctly_set org.flyway