use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchMethodFailureAnalyzerTests method whenAMethodOnAClassIsMissingThenNoSuchMethodErrorIsAnalyzed.
@Test
void whenAMethodOnAClassIsMissingThenNoSuchMethodErrorIsAnalyzed() {
Throwable failure = createFailureForMissingMethod();
assertThat(failure).isNotNull();
failure.printStackTrace();
FailureAnalysis analysis = new NoSuchMethodFailureAnalyzer().analyze(failure);
assertThat(analysis).isNotNull();
assertThat(analysis.getDescription()).contains(NoSuchMethodFailureAnalyzerTests.class.getName() + ".createFailureForMissingMethod(").contains("isMoreSpecific(").contains("calling method's class, " + NoSuchMethodFailureAnalyzerTests.class.getName() + ",").contains("called method's class, org.springframework.util.MimeType,");
assertThat(analysis.getAction()).contains(NoSuchMethodFailureAnalyzerTests.class.getName()).contains("org.springframework.util.MimeType");
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoSuchMethodFailureAnalyzerTests method whenAnInheritedMethodIsMissingThenNoSuchMethodErrorIsAnalyzed.
@Test
void whenAnInheritedMethodIsMissingThenNoSuchMethodErrorIsAnalyzed() {
Throwable failure = createFailureForMissingInheritedMethod();
assertThat(failure).isNotNull();
FailureAnalysis analysis = new NoSuchMethodFailureAnalyzer().analyze(failure);
assertThat(analysis).isNotNull();
assertThat(analysis.getDescription()).contains(R2dbcMappingContext.class.getName() + ".<init>(").contains(R2dbcMappingContext.class.getName() + ".setForceQuote(").contains("calling method's class, org.springframework.data.r2dbc.mapping.R2dbcMappingContext,").contains("called method's class, org.springframework.data.r2dbc.mapping.R2dbcMappingContext,").contains(" org.springframework.data.r2dbc.mapping.R2dbcMappingContext").contains(" org.springframework.data.relational.core.mapping.RelationalMappingContext").contains(" org.springframework.data.mapping.context.AbstractMappingContext");
assertThat(analysis.getAction()).contains("org.springframework.data.r2dbc.mapping.R2dbcMappingContext");
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoUniqueBeanDefinitionFailureAnalyzerTests method failureAnalysisForObjectProviderMethodConsumer.
@Test
void failureAnalysisForObjectProviderMethodConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(ObjectProviderMethodConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Method consumer in " + ObjectProviderMethodConsumer.class.getName() + " required a single bean, but 6 were found:");
assertFoundBeans(failureAnalysis);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoUniqueBeanDefinitionFailureAnalyzerTests method failureAnalysisForMethodConsumer.
@Test
void failureAnalysisForMethodConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(MethodConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Parameter 0 of method consumer in " + MethodConsumer.class.getName() + " required a single bean, but 6 were found:");
assertFoundBeans(failureAnalysis);
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NoUniqueBeanDefinitionFailureAnalyzerTests method failureAnalysisForConstructorConsumer.
@Test
void failureAnalysisForConstructorConsumer() {
FailureAnalysis failureAnalysis = analyzeFailure(createFailure(ConstructorConsumer.class));
assertThat(failureAnalysis.getDescription()).startsWith("Parameter 0 of constructor in " + ConstructorConsumer.class.getName() + " required a single bean, but 6 were found:");
assertFoundBeans(failureAnalysis);
}
Aggregations