Source:
<code>private File getScriptFile() { URL logbackTestUrl = DescribeIT.class.getResource("/logback-test.xml"); if (logbackTestUrl == null || logbackTestUrl.getFile().isEmpty()) { fail( "Expected to use logback-test.xml to determine location of " + "target/test-classes, but got URL %s", logbackTestUrl); } File resourcesDir = new File(logbackTestUrl.getFile()).getParentFile(); File scriptsDir = new File(resourcesDir, isDse ? "DescribeIT/dse" : "DescribeIT/oss"); LOG.debug("Looking for a matching script in directory {}", scriptsDir); File[] candidates = scriptsDir.listFiles(); assertThat(candidates).isNotNull(); File bestFile = null; Version bestVersion = null; for (File candidate : candidates) { String fileName = candidate.getName(); String candidateVersionString = fileName.substring(0, fileName.lastIndexOf('.')); Version candidateVersion = Version.parse(candidateVersionString); LOG.debug("Considering {}, which resolves to version {}", fileName, candidateVersion); if (candidateVersion.compareTo(serverVersion) > 0) { LOG.debug("too high, discarding"); } else if (bestVersion != null && bestVersion.compareTo(candidateVersion) >= 0) { LOG.debug("not higher than {}, discarding", bestVersion); } else { LOG.debug("best so far"); bestVersion = candidateVersion; bestFile = candidate; } } if (bestFile == null) { fail("Could not find create script with version <= %s in %s", serverVersion, scriptsDir); <START> throw new AssertionError(); END> } else { LOG.info( "Using to test against {}", bestFile, isDse ? "DSE" : "Cassandra", serverVersion); return bestFile; } }</code><technical_language>nit: need this, do we? test fail line if get here</technical_language>

Target:
private File getScriptFile() { URL logbackTestUrl = DescribeIT.class.getResource("/logback-test.xml"); if (logbackTestUrl == null || logbackTestUrl.getFile().isEmpty()) { fail( "Expected to use logback-test.xml to determine location of " + "target/test-classes, but got URL %s", logbackTestUrl); } File resourcesDir = new File(logbackTestUrl.getFile()).getParentFile(); File scriptsDir = new File(resourcesDir, isDse ? "DescribeIT/dse" : "DescribeIT/oss"); LOG.debug("Looking for a matching script in directory {}", scriptsDir); File[] candidates = scriptsDir.listFiles(); assertThat(candidates).isNotNull(); File bestFile = null; Version bestVersion = null; for (File candidate : candidates) { String fileName = candidate.getName(); String candidateVersionString = fileName.substring(0, fileName.lastIndexOf('.')); Version candidateVersion = Version.parse(candidateVersionString); LOG.debug("Considering {}, which resolves to version {}", fileName, candidateVersion); if (candidateVersion.compareTo(serverVersion) > 0) { LOG.debug("too high, discarding"); } else if (bestVersion != null && bestVersion.compareTo(candidateVersion) >= 0) { LOG.debug("not higher than {}, discarding", bestVersion); } else { LOG.debug("best so far"); bestVersion = candidateVersion; bestFile = candidate; } } assertThat(bestFile) .as("Could not find create script with version <= %s in %s", serverVersion, scriptsDir) .isNotNull(); LOG.info( "Using to test against {}", bestFile, isDse ? "DSE" : "Cassandra", serverVersion); return bestFile; }