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.
This commit is contained in:
Andy Wilkinson 2017-01-18 13:38:10 +00:00
parent 2a5586fbcf
commit 0e72ef1a10

View File

@ -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);
}
}