commit
772e4ca78d
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -51,7 +51,7 @@ class InvalidConfigurationPropertyValueFailureAnalyzer
|
|||
protected FailureAnalysis analyze(Throwable rootFailure, InvalidConfigurationPropertyValueException cause) {
|
||||
List<Descriptor> descriptors = getDescriptors(cause.getName());
|
||||
if (descriptors.isEmpty()) {
|
||||
return null;
|
||||
descriptors = List.of(new Descriptor(null, cause.getValue(), null));
|
||||
}
|
||||
StringBuilder description = new StringBuilder();
|
||||
appendDetails(description, cause, descriptors);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -45,7 +45,8 @@ class InvalidConfigurationPropertyValueFailureAnalyzerTests {
|
|||
InvalidConfigurationPropertyValueException failure = new InvalidConfigurationPropertyValueException(
|
||||
"test.property", "invalid", "This is not valid.");
|
||||
FailureAnalysis analysis = new InvalidConfigurationPropertyValueFailureAnalyzer(null).analyze(failure);
|
||||
assertThat(analysis).isNull();
|
||||
assertThat(analysis.getDescription())
|
||||
.contains("Invalid value 'invalid' for configuration property 'test.property'.");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,7 +99,9 @@ class InvalidConfigurationPropertyValueFailureAnalyzerTests {
|
|||
void analysisWithUnknownKey() {
|
||||
InvalidConfigurationPropertyValueException failure = new InvalidConfigurationPropertyValueException(
|
||||
"test.key.not.defined", "invalid", "This is not valid.");
|
||||
assertThat(performAnalysis(failure)).isNull();
|
||||
FailureAnalysis analysis = performAnalysis(failure);
|
||||
assertThat(analysis.getDescription())
|
||||
.contains("Invalid value 'invalid' for configuration property 'test.key.not.defined'.");
|
||||
}
|
||||
|
||||
private void assertCommonParts(InvalidConfigurationPropertyValueException failure, FailureAnalysis analysis) {
|
||||
|
|
Loading…
Reference in New Issue