diff options
author | zachdriver <zach@driver.xyz> | 2017-02-22 08:58:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-22 08:58:08 -0800 |
commit | 517ef20648c6c202e0718067681bc8aa51f5b630 (patch) | |
tree | e9543d7d50d09dec30d73ddc3b8ec0bb9a6e2224 /src/test/scala/xyz/driver/core | |
parent | 3c9b0ed55e3721595dafa273b015dec6add8c18b (diff) | |
parent | 46d64c04b5ef7d323cbba7d7375e48da59789ea7 (diff) | |
download | driver-core-517ef20648c6c202e0718067681bc8aa51f5b630.tar.gz driver-core-517ef20648c6c202e0718067681bc8aa51f5b630.tar.bz2 driver-core-517ef20648c6c202e0718067681bc8aa51f5b630.zip |
Merge pull request #21 from drivergroup/zsmith/messages/nestedv0.10.11
Allow Messages file format to use nested dict's
Diffstat (limited to 'src/test/scala/xyz/driver/core')
-rw-r--r-- | src/test/scala/xyz/driver/core/MessagesTest.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/core/MessagesTest.scala b/src/test/scala/xyz/driver/core/MessagesTest.scala index dc44ee1..5558156 100644 --- a/src/test/scala/xyz/driver/core/MessagesTest.scala +++ b/src/test/scala/xyz/driver/core/MessagesTest.scala @@ -77,4 +77,28 @@ class MessagesTest extends FlatSpec with Matchers with MockitoSugar { verify(log).error(s"Message with key 'howdy' not found for locale 'en'") } + + it should "be able to read nested keys in multiple forms" in { + val log = mock[Logger] + + val configString = + """ + | en { + | foo.bar = "Foo Bar" + | + | baz { + | boo = "Baz Boo" + | booFormat = "Baz Boo {0}" + | } + | } + """.stripMargin + + val messagesConfig = ConfigFactory.parseString(configString) + + val messages = Messages.messages(messagesConfig, log, Locale.US) + + messages("foo.bar") should be("Foo Bar") + messages("baz.boo") should be("Baz Boo") + messages("baz.booFormat", "Test") should be("Baz Boo Test") + } } |