From 0e72ef1a105cfb295112df414f926957092869b4 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 18 Jan 2017 13:38:10 +0000 Subject: [PATCH] Improve diagnostics for in StarterDependenciesIntegrationTests The root cause of the build failure something has a null message which means there's no information available about why the build failed. Instead of calling fail when a BuildException occurs, this commit wraps it in a RuntimeException and rethrows it. This should make the entire chain of exceptions available when a failure occurs. --- .../boot/starter/StarterDependenciesIntegrationTests.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java index dfe84ad31c..41df17e4c7 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java @@ -34,8 +34,6 @@ import org.junit.runners.Parameterized.Parameters; import org.springframework.boot.gradle.ProjectCreator; import org.springframework.boot.gradle.Versions; -import static org.junit.Assert.fail; - /** * Tests for the various starter projects to check that they don't pull in unwanted * transitive dependencies when used with Gradle @@ -109,11 +107,7 @@ public class StarterDependenciesIntegrationTests { project.newBuild().forTasks(task).withArguments(this.buildArguments).run(); } catch (BuildException ex) { - Throwable root = ex; - while (root.getCause() != null) { - root = root.getCause(); - } - fail(root.getMessage()); + throw new RuntimeException(ex); } }