"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/FilteredConfigurationPropertiesSourceTests.java" between
spring-boot-2.7.3.tar.gz and spring-boot-2.7.4.tar.gz

About: Spring Boot helps to create Spring-powered, production-grade applications and services.

FilteredConfigurationPropertiesSourceTests.java  (spring-boot-2.7.3):FilteredConfigurationPropertiesSourceTests.java  (spring-boot-2.7.4)
skipping to change at line 22 skipping to change at line 22
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.context.properties.source; package org.springframework.boot.context.properties.source;
import java.util.Objects; import java.util.Objects;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.Answers;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException ; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException ;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/** /**
* Test for {@link FilteredIterableConfigurationPropertiesSource}. * Test for {@link FilteredIterableConfigurationPropertiesSource}.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Madhura Bhave * @author Madhura Bhave
*/ */
class FilteredConfigurationPropertiesSourceTests { class FilteredConfigurationPropertiesSourceTests {
@Test @Test
skipping to change at line 67 skipping to change at line 64
assertThat(source.getConfigurationProperty(name).getValue()).isEq ualTo("1"); assertThat(source.getConfigurationProperty(name).getValue()).isEq ualTo("1");
assertThat(filtered.getConfigurationProperty(name).getValue()).is EqualTo("1"); assertThat(filtered.getConfigurationProperty(name).getValue()).is EqualTo("1");
ConfigurationPropertyName bracketName = ConfigurationPropertyName .of("a[1]"); ConfigurationPropertyName bracketName = ConfigurationPropertyName .of("a[1]");
assertThat(source.getConfigurationProperty(bracketName).getValue( )).isEqualTo("2"); assertThat(source.getConfigurationProperty(bracketName).getValue( )).isEqualTo("2");
assertThat(filtered.getConfigurationProperty(bracketName)).isNull (); assertThat(filtered.getConfigurationProperty(bracketName)).isNull ();
} }
@Test @Test
void containsDescendantOfWhenSourceReturnsEmptyShouldReturnEmpty() { void containsDescendantOfWhenSourceReturnsEmptyShouldReturnEmpty() {
ConfigurationPropertyName name = ConfigurationPropertyName.of("fo o"); ConfigurationPropertyName name = ConfigurationPropertyName.of("fo o");
ConfigurationPropertySource source = mock(ConfigurationPropertySo ConfigurationPropertySource source = new KnownAncestorsConfigurat
urce.class, Answers.CALLS_REAL_METHODS); ionPropertySource().unknown(name);
given(source.containsDescendantOf(name)).willReturn(Configuration
PropertyState.UNKNOWN);
ConfigurationPropertySource filtered = source.filter((n) -> true) ; ConfigurationPropertySource filtered = source.filter((n) -> true) ;
assertThat(filtered.containsDescendantOf(name)).isEqualTo(Configu rationPropertyState.UNKNOWN); assertThat(filtered.containsDescendantOf(name)).isEqualTo(Configu rationPropertyState.UNKNOWN);
} }
@Test @Test
void containsDescendantOfWhenSourceReturnsFalseShouldReturnFalse() { void containsDescendantOfWhenSourceReturnsFalseShouldReturnFalse() {
ConfigurationPropertyName name = ConfigurationPropertyName.of("fo o"); ConfigurationPropertyName name = ConfigurationPropertyName.of("fo o");
ConfigurationPropertySource source = mock(ConfigurationPropertySo ConfigurationPropertySource source = new KnownAncestorsConfigurat
urce.class, Answers.CALLS_REAL_METHODS); ionPropertySource().absent(name);
given(source.containsDescendantOf(name)).willReturn(Configuration
PropertyState.ABSENT);
ConfigurationPropertySource filtered = source.filter((n) -> true) ; ConfigurationPropertySource filtered = source.filter((n) -> true) ;
assertThat(filtered.containsDescendantOf(name)).isEqualTo(Configu rationPropertyState.ABSENT); assertThat(filtered.containsDescendantOf(name)).isEqualTo(Configu rationPropertyState.ABSENT);
} }
@Test @Test
void containsDescendantOfWhenSourceReturnsTrueShouldReturnEmpty() { void containsDescendantOfWhenSourceReturnsTrueShouldReturnEmpty() {
ConfigurationPropertyName name = ConfigurationPropertyName.of("fo o"); ConfigurationPropertyName name = ConfigurationPropertyName.of("fo o");
ConfigurationPropertySource source = mock(ConfigurationPropertySo ConfigurationPropertySource source = new KnownAncestorsConfigurat
urce.class, Answers.CALLS_REAL_METHODS); ionPropertySource().present(name);
given(source.containsDescendantOf(name)).willReturn(Configuration
PropertyState.PRESENT);
ConfigurationPropertySource filtered = source.filter((n) -> true) ; ConfigurationPropertySource filtered = source.filter((n) -> true) ;
assertThat(filtered.containsDescendantOf(name)).isEqualTo(Configu rationPropertyState.UNKNOWN); assertThat(filtered.containsDescendantOf(name)).isEqualTo(Configu rationPropertyState.UNKNOWN);
} }
protected final ConfigurationPropertySource createTestSource() { protected final ConfigurationPropertySource createTestSource() {
MockConfigurationPropertySource source = new MockConfigurationPro pertySource(); MockConfigurationPropertySource source = new MockConfigurationPro pertySource();
source.put("a", "1"); source.put("a", "1");
source.put("a[1]", "2"); source.put("a[1]", "2");
source.put("b", "3"); source.put("b", "3");
source.put("b[1]", "4"); source.put("b[1]", "4");
 End of changes. 5 change blocks. 
15 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)