Skip to content

Commit 6185422

Browse files
committed
Improve error message in test if a version entry is missing
1 parent 9bbc4b7 commit 6185422

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/groovy/org/gradlex/jvm/dependency/conflict/test/JarOverlapTest.groovy

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import static org.gradlex.jvm.dependency.conflict.detection.rules.CapabilityDefi
1212
* Test that checks that the Jar files behind each CapabilityDefinition actually have overlapping classes.
1313
*/
1414
class JarOverlapTest extends Specification {
15+
private static final String SAMPLE_ALL_BUILD_FILE = "samples/sample-all/build.gradle.kts"
1516

1617
// Some Jars do not have overlapping classes, but contain conflicting implementations of the same service.
1718
static def expectedToOverlap = values() - [
@@ -28,7 +29,7 @@ class JarOverlapTest extends Specification {
2829
def latestVersions = []
2930

3031
void setup() {
31-
latestVersions = new File("samples/sample-all/build.gradle.kts")
32+
latestVersions = new File(SAMPLE_ALL_BUILD_FILE)
3233
.readLines()
3334
.findAll { it.contains("implementation(") }
3435
.collect { it.trim() }
@@ -56,7 +57,11 @@ class JarOverlapTest extends Specification {
5657
if (specific) {
5758
dependencies.create(specific)
5859
} else {
59-
dependencies.create(latestVersions.find { it.startsWith(module + ":") })
60+
def moduleForSample = latestVersions.find { it.startsWith(module + ":") }
61+
if (!moduleForSample) {
62+
throw new RuntimeException("Missing entry for " + module + " in " + SAMPLE_ALL_BUILD_FILE)
63+
}
64+
dependencies.create(moduleForSample)
6065
}
6166
}
6267

0 commit comments

Comments
 (0)