Merge branch '2.7.x' into 3.0.x
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2023 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.
|
||||
@@ -52,9 +52,10 @@ class RawConfigurationMetadata {
|
||||
return null;
|
||||
}
|
||||
return this.sources.stream()
|
||||
.filter((candidate) -> item.getSourceType().equals(candidate.getType())
|
||||
&& item.getId().startsWith(candidate.getGroupId()))
|
||||
.max(Comparator.comparingInt((candidate) -> candidate.getGroupId().length())).orElse(null);
|
||||
.filter((candidate) -> item.getSourceType().equals(candidate.getType())
|
||||
&& item.getId().startsWith(candidate.getGroupId()))
|
||||
.max(Comparator.comparingInt((candidate) -> candidate.getGroupId().length()))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
List<ConfigurationMetadataItem> getItems() {
|
||||
|
||||
@@ -36,7 +36,7 @@ class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurat
|
||||
@Test
|
||||
void nullResource() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> ConfigurationMetadataRepositoryJsonBuilder.create().withJsonResource(null));
|
||||
.isThrownBy(() -> ConfigurationMetadataRepositoryJsonBuilder.create().withJsonResource(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -105,7 +105,7 @@ class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurat
|
||||
assertThat(group.getSources().get("org.acme.Foo2").getProperties()).containsOnlyKeys("spring.foo.enabled",
|
||||
"spring.foo.type");
|
||||
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
|
||||
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
||||
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class ConfigurationMetadataRepositoryJsonBuilderTests extends AbstractConfigurat
|
||||
assertThat(group.getSources().get("org.acme.Foo").getProperties()).containsOnlyKeys("spring.foo.name",
|
||||
"spring.foo.description", "spring.foo.enabled", "spring.foo.type");
|
||||
assertThat(group.getSources().get("org.springframework.boot.FooProperties").getProperties())
|
||||
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
||||
.containsOnlyKeys("spring.foo.name", "spring.foo.counter");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class JsonReaderTests extends AbstractConfigurationMetadataTests {
|
||||
ValueHint valueHint = hint.getValueHints().get(0);
|
||||
assertThat(valueHint.getValue()).isEqualTo(42);
|
||||
assertThat(valueHint.getDescription())
|
||||
.isEqualTo("Because that's the answer to any question, choose it. \nReally.");
|
||||
.isEqualTo("Because that's the answer to any question, choose it. \nReally.");
|
||||
assertThat(valueHint.getShortDescription()).isEqualTo("Because that's the answer to any question, choose it.");
|
||||
assertThat(hint.getValueProviders()).hasSize(1);
|
||||
ValueProvider valueProvider = hint.getValueProviders().get(0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 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.
|
||||
@@ -40,14 +40,14 @@ class SentenceExtractorTests {
|
||||
@Test
|
||||
void extractFirstSentenceNewLineBeforeDot() {
|
||||
String sentence = this.extractor
|
||||
.getFirstSentence("My short" + NEW_LINE + "description." + NEW_LINE + "More stuff.");
|
||||
.getFirstSentence("My short" + NEW_LINE + "description." + NEW_LINE + "More stuff.");
|
||||
assertThat(sentence).isEqualTo("My short description.");
|
||||
}
|
||||
|
||||
@Test
|
||||
void extractFirstSentenceNewLineBeforeDotWithSpaces() {
|
||||
String sentence = this.extractor
|
||||
.getFirstSentence("My short " + NEW_LINE + " description. " + NEW_LINE + "More stuff.");
|
||||
.getFirstSentence("My short " + NEW_LINE + " description. " + NEW_LINE + "More stuff.");
|
||||
assertThat(sentence).isEqualTo("My short description.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user