Source:
public String getInitialLiquibaseSnapshotVersion( String context, LiquibaseProvider liquibaseProvider ) throws Exception { log.debug( "identifying the Liquibase snapshot version that had been used to initialize the OpenMRS database..." ); Map<String, List<String>> snapshotCombinations = changeLogVersionFinder.getSnapshotCombinations(); if ( snapshotCombinations.isEmpty() ) { throw new IllegalStateException( "identifying the Liqubase snapshot version that had been used to initialize the OpenMRS database failed as no candidate change sets were found" ); } List<String> snapshotVersions = getSnapshotVersionsInDescendingOrder( snapshotCombinations ); for ( String version: snapshotVersions ) { int unrunChangeSetsCount = 0; log.debug( String.format( "looking for un-run change sets in snapshot version '%s'", version ) ); List<String> changeSets = snapshotCombinations.get( version ); for ( String filename: changeSets ) { Liquibase liquibase = liquibaseProvider.getLiquibase( filename ); List<ChangeSet> rawUnrunChangeSets = liquibase.listUnrunChangeSets( new Contexts( context ), new LabelExpression() ); List<ChangeSet> refinedUnrunChangeSets = excludeVintageChangeSets( rawUnrunChangeSets ); log.debug( String.format( "file '%s' contains %d un-run change sets", filename, refinedUnrunChangeSets.size() ) ); logUnrunChangeSetDetails( filename, refinedUnrunChangeSets ); unrunChangeSetsCount += refinedUnrunChangeSets.size(); } if ( unrunChangeSetsCount == 0 ) { log.debug( String.format( "the Liquibase snapshot version that had been used to initialize the OpenMRS database is '%s'", version ) ); return version; } } throw new IllegalStateException( "identifying the snapshot version that had been used to initialize the OpenMRS database failed as no candidate change set resulted in zero un-run changes" ); }

Target:
public String getInitialLiquibaseSnapshotVersion(String context, LiquibaseProvider liquibaseProvider) throws Exception { log.info("identifying the Liquibase snapshot version that had been used to initialize the OpenMRS database..."); Map<String, List<String>> snapshotCombinations = changeLogVersionFinder.getSnapshotCombinations(); if (snapshotCombinations.isEmpty()) { throw new IllegalStateException( "identifying the Liqubase snapshot version that had been used to initialize the OpenMRS database failed as no candidate change sets were found"); } List<String> snapshotVersions = getSnapshotVersionsInDescendingOrder(snapshotCombinations); for (String version : snapshotVersions) { int unrunChangeSetsCount = 0; log.info("looking for un-run change sets in snapshot version '{}'", version); List<String> changeSets = snapshotCombinations.get(version); for (String filename : changeSets) { Liquibase liquibase = liquibaseProvider.getLiquibase(filename); List<ChangeSet> rawUnrunChangeSets = liquibase.listUnrunChangeSets(new Contexts(context), new LabelExpression()); List<ChangeSet> refinedUnrunChangeSets = excludeVintageChangeSets(filename, rawUnrunChangeSets); log.info("file '{}' contains un-run change sets", filename, refinedUnrunChangeSets.size()); logUnrunChangeSetDetails(filename, refinedUnrunChangeSets); unrunChangeSetsCount += refinedUnrunChangeSets.size(); } if (unrunChangeSetsCount == 0) { log.info("the Liquibase snapshot version that had been used to initialize the OpenMRS database is '{}'", version); return version; } } throw new IllegalStateException( "identifying the snapshot version that had been used to initialize the OpenMRS database failed as no candidate change set resulted in zero un-run changes"); }