use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class BindFailureAnalyzerTests method bindExceptionWithNestedFailureShouldDisplayNestedMessage.
@Test
void bindExceptionWithNestedFailureShouldDisplayNestedMessage() {
FailureAnalysis analysis = performAnalysis(NestedFailureConfiguration.class, "test.foo.value=hello");
assertThat(analysis.getDescription()).contains(failure("test.foo.value", "hello", "\"test.foo.value\" from property source \"test\"", "java.lang.RuntimeException: This is a failure"));
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class BindFailureAnalyzerTests method analysisForUnboundElementsIsNull.
@Test
void analysisForUnboundElementsIsNull() {
FailureAnalysis analysis = performAnalysis(UnboundElementsFailureConfiguration.class, "test.foo.listValue[0]=hello", "test.foo.listValue[2]=world");
assertThat(analysis).isNull();
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project bucket4j-spring-boot-starter by MarcGiffing.
the class Bucket4JAutoConfigFailureAnalyzer method analyze.
@Override
protected FailureAnalysis analyze(Throwable rootFailure, Bucket4jGeneralException cause) {
String descriptionMessage = cause.getMessage();
String actionMessage = cause.getMessage();
if (cause instanceof JCacheNotFoundException) {
JCacheNotFoundException ex = (JCacheNotFoundException) cause;
descriptionMessage = "The cache name name defined in the property is not configured in the caching provider";
actionMessage = "Cache name: " + ex.getCacheName() + newline + "Please configure your caching provider (ehcache, hazelcast, ...)";
}
if (cause instanceof MissingKeyFilterExpressionException) {
descriptionMessage = "You've set the 'filter-key-type' to 'expression' but didn't set the property 'expression'";
actionMessage = "Please set the property 'expression' in your configuration file with a valid expression (see Spring Expression Language)" + newline;
}
return new FailureAnalysis(descriptionMessage, actionMessage, cause);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerAutoConfigurationTest method assertFailureAnalysis.
private void assertFailureAnalysis(Throwable t) {
FailureAnalyzer analyzer = new RequiredCatalogBeanFailureAnalyzer();
FailureAnalysis analysis = analyzer.analyze(t);
assertThat(analysis).isNotNull();
assertThat(analysis.getDescription()).isEqualTo(ANALYZER_DESCRIPTION);
}
Aggregations