|
|
|
@ -24,7 +24,6 @@ import org.mockito.Answers; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.mockito.BDDMockito.given; |
|
|
|
import static org.mockito.BDDMockito.given; |
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
import static org.mockito.Mockito.withSettings; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Tests for {@link AliasedConfigurationPropertySource}. |
|
|
|
* Tests for {@link AliasedConfigurationPropertySource}. |
|
|
|
@ -59,7 +58,7 @@ public class AliasedConfigurationPropertySourceTests { |
|
|
|
public void containsDescendantOfWhenSourceReturnsUnknownShouldReturnUnknown() { |
|
|
|
public void containsDescendantOfWhenSourceReturnsUnknownShouldReturnUnknown() { |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); |
|
|
|
Answers.CALLS_REAL_METHODS); |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
.willReturn(ConfigurationPropertyState.UNKNOWN); |
|
|
|
.willReturn(ConfigurationPropertyState.UNKNOWN); |
|
|
|
ConfigurationPropertySource aliased = source |
|
|
|
ConfigurationPropertySource aliased = source |
|
|
|
@ -72,7 +71,7 @@ public class AliasedConfigurationPropertySourceTests { |
|
|
|
public void containsDescendantOfWhenSourceReturnsPresentShouldReturnPresent() { |
|
|
|
public void containsDescendantOfWhenSourceReturnsPresentShouldReturnPresent() { |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); |
|
|
|
Answers.CALLS_REAL_METHODS); |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
.willReturn(ConfigurationPropertyState.PRESENT); |
|
|
|
.willReturn(ConfigurationPropertyState.PRESENT); |
|
|
|
given(source.containsDescendantOf(ConfigurationPropertyName.of("bar"))) |
|
|
|
given(source.containsDescendantOf(ConfigurationPropertyName.of("bar"))) |
|
|
|
@ -87,7 +86,7 @@ public class AliasedConfigurationPropertySourceTests { |
|
|
|
public void containsDescendantOfWhenAllAreAbsentShouldReturnAbsent() { |
|
|
|
public void containsDescendantOfWhenAllAreAbsentShouldReturnAbsent() { |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); |
|
|
|
Answers.CALLS_REAL_METHODS); |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
.willReturn(ConfigurationPropertyState.ABSENT); |
|
|
|
.willReturn(ConfigurationPropertyState.ABSENT); |
|
|
|
given(source.containsDescendantOf(ConfigurationPropertyName.of("bar"))) |
|
|
|
given(source.containsDescendantOf(ConfigurationPropertyName.of("bar"))) |
|
|
|
@ -102,7 +101,7 @@ public class AliasedConfigurationPropertySourceTests { |
|
|
|
public void containsDescendantOfWhenAnyIsPresentShouldReturnPresent() { |
|
|
|
public void containsDescendantOfWhenAnyIsPresentShouldReturnPresent() { |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("foo"); |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
ConfigurationPropertySource source = mock(ConfigurationPropertySource.class, |
|
|
|
withSettings().defaultAnswer(Answers.CALLS_REAL_METHODS)); |
|
|
|
Answers.CALLS_REAL_METHODS); |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
given(source.containsDescendantOf(name)) |
|
|
|
.willReturn(ConfigurationPropertyState.ABSENT); |
|
|
|
.willReturn(ConfigurationPropertyState.ABSENT); |
|
|
|
given(source.containsDescendantOf(ConfigurationPropertyName.of("bar"))) |
|
|
|
given(source.containsDescendantOf(ConfigurationPropertyName.of("bar"))) |
|
|
|
|