|
|
|
@ -107,7 +107,7 @@ public class YamlPropertiesFactoryBeanTests {
@@ -107,7 +107,7 @@ public class YamlPropertiesFactoryBeanTests {
|
|
|
|
|
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean(); |
|
|
|
|
factory.setResources(new ByteArrayResource( |
|
|
|
|
"foo: bar\nspam: baz\n---\nfoo: bag\nspam: bad".getBytes())); |
|
|
|
|
factory.setDocumentMatchers((DocumentMatcher) properties -> ("bag".equals(properties.getProperty("foo")) ? |
|
|
|
|
factory.setDocumentMatchers(properties -> ("bag".equals(properties.getProperty("foo")) ? |
|
|
|
|
MatchStatus.FOUND : MatchStatus.NOT_FOUND)); |
|
|
|
|
Properties properties = factory.getObject(); |
|
|
|
|
assertThat(properties.getProperty("foo"), equalTo("bag")); |
|
|
|
@ -120,7 +120,7 @@ public class YamlPropertiesFactoryBeanTests {
@@ -120,7 +120,7 @@ public class YamlPropertiesFactoryBeanTests {
|
|
|
|
|
factory.setMatchDefault(true); |
|
|
|
|
factory.setResources(new ByteArrayResource( |
|
|
|
|
"one: two\n---\nfoo: bar\nspam: baz\n---\nfoo: bag\nspam: bad".getBytes())); |
|
|
|
|
factory.setDocumentMatchers((DocumentMatcher) properties -> { |
|
|
|
|
factory.setDocumentMatchers(properties -> { |
|
|
|
|
if (!properties.containsKey("foo")) { |
|
|
|
|
return MatchStatus.ABSTAIN; |
|
|
|
|
} |
|
|
|
@ -161,7 +161,7 @@ public class YamlPropertiesFactoryBeanTests {
@@ -161,7 +161,7 @@ public class YamlPropertiesFactoryBeanTests {
|
|
|
|
|
factory.setMatchDefault(true); |
|
|
|
|
factory.setResources(new ByteArrayResource( |
|
|
|
|
"one: two\n---\nfoo: bag\nspam: bad\n---\nfoo: bar\nspam: baz".getBytes())); |
|
|
|
|
factory.setDocumentMatchers((DocumentMatcher) properties -> { |
|
|
|
|
factory.setDocumentMatchers(properties -> { |
|
|
|
|
if (!properties.containsKey("foo")) { |
|
|
|
|
return MatchStatus.ABSTAIN; |
|
|
|
|
} |
|
|
|
|