Clarify when a property was not renamed due to an incompatible type
Closes gh-11794
This commit is contained in:
@@ -141,6 +141,18 @@ public class PropertiesMigrationReporterTests {
|
||||
assertMappedProperty(propertySource, "test.mapped.ttl", 5678L, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void reasonIsProvidedIfPropertyCouldNotBeRenamed() throws IOException {
|
||||
this.environment.getPropertySources().addFirst(loadPropertySource("test",
|
||||
"config/config-error-no-compatible-type.properties"));
|
||||
String report = createErrorReport(
|
||||
loadRepository("metadata/type-conversion-metadata.json"));
|
||||
assertThat(report).isNotNull();
|
||||
assertThat(report).containsSubsequence("Property source 'test'",
|
||||
"wrong.inconvertible", "Line: 1", "Reason: Replacement key "
|
||||
+ "'test.inconvertible' uses an incompatible target type");
|
||||
}
|
||||
|
||||
private List<String> mapToNames(PropertySources sources) {
|
||||
List<String> names = new ArrayList<>();
|
||||
for (PropertySource<?> source : sources) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
wrong.inconvertible=abc
|
||||
@@ -12,6 +12,10 @@
|
||||
"name": "test.mapped",
|
||||
"type": "java.util.Map<java.lang.String, java.time.Duration>"
|
||||
},
|
||||
{
|
||||
"name": "test.inconvertible",
|
||||
"type": "com.example.One"
|
||||
},
|
||||
{
|
||||
"name": "test.cache-seconds",
|
||||
"type": "java.lang.Integer",
|
||||
@@ -35,6 +39,14 @@
|
||||
"replacement": "test.mapped.ttl",
|
||||
"level": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "wrong.inconvertible",
|
||||
"type": "com.example.Two",
|
||||
"deprecation": {
|
||||
"replacement": "test.inconvertible",
|
||||
"level": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user