Package org.gradle.api

Examples of org.gradle.api.LocationAwareException


                details.resolution.text(" option to get the full (very verbose) stacktrace.");
            }
        }

        if (failure instanceof LocationAwareException) {
            LocationAwareException scriptException = (LocationAwareException) failure;
            if (scriptException.getLocation() != null) {
                details.location.text(scriptException.getLocation());
            }
            details.details.text(scriptException.getOriginalMessage());
            for (Throwable cause : scriptException.getReportableCauses()) {
                details.details.format("%nCause: %s", getMessage(cause));
            }
        } else {
            details.details.text(getMessage(failure));
        }
View Full Code Here


        notifyAnalyser(analyser, source);

        Throwable transformedFailure = analyser.transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));

        LocationAwareException gse = (LocationAwareException) transformedFailure;
        assertThat(gse.getScriptSource(), sameInstance(source));
        assertThat(gse.getLineNumber(), equalTo(7));
    }
View Full Code Here

        notifyAnalyser(analyser, source);

        Throwable transformedFailure = analyser.transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));

        LocationAwareException gse = (LocationAwareException) transformedFailure;
        assertThat(gse.getScriptSource(), sameInstance(source));
        assertThat(gse.getLineNumber(), equalTo(7));
    }
View Full Code Here

        notifyAnalyser(analyser, source);

        Throwable transformedFailure = analyser.transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));

        LocationAwareException gse = (LocationAwareException) transformedFailure;
        assertThat(gse.getScriptSource(), sameInstance(source));
        assertThat(gse.getLineNumber(), equalTo(7));
    }
View Full Code Here

    public void wrapsOriginalExceptionWhenLocationCannotBeDetermined() {
        Throwable failure = new ContextualException();
        Throwable transformedFailure = analyser().transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));

        LocationAwareException gse = (LocationAwareException) transformedFailure;
        assertThat(gse.getScriptSource(), nullValue());
        assertThat(gse.getLineNumber(), nullValue());
    }
View Full Code Here

      if (failure != null) {
            formatter.format("%n");

            if (failure instanceof LocationAwareException) {
                LocationAwareException scriptException = (LocationAwareException) failure;
                formatter.format("%s%n%n", scriptException.getLocation());
                formatter.format("%s", scriptException.getOriginalMessage());

                for (Throwable cause : scriptException.getReportableCauses()) {
                    formatter.format("%nCause: %s", getMessage(cause));
                }
            } else {
                formatter.format("%s", getMessage(failure));
            }
View Full Code Here

            return this;
        }

        public ExecutionFailure assertThatCause(final Matcher<String> matcher) {
            if (failure instanceof LocationAwareException) {
                LocationAwareException exception = (LocationAwareException) failure;
                assertThat(exception.getReportableCauses(), hasItem(hasMessage(matcher)));
            } else {
                assertThat(failure.getCause(), notNullValue());
                assertThat(failure.getCause().getMessage(), matcher);
            }
            return this;
View Full Code Here

TOP

Related Classes of org.gradle.api.LocationAwareException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.