Skip to content

Commit

Permalink
issue #616 PR comments: add a unit test for getXXX() as XXX type
Browse files Browse the repository at this point in the history
  • Loading branch information
wajda committed Feb 27, 2023
1 parent 768baf6 commit 284696b
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class YAMLConfigurationTest extends ReadOnlyConfigurationTest {
test("null values should be completely ignored") {
givenConf.containsKey("spline.null_value") shouldBe false
givenConf.getKeys("spline").asScala.toSeq shouldNot contain("spline.null_value")
givenConf.getProperty("spline.null_value") shouldEqual null
givenConf.getProperty("spline.null_value") shouldBe null
}

test("get string value as String") {
Expand All @@ -70,9 +70,9 @@ class YAMLConfigurationTest extends ReadOnlyConfigurationTest {
}

test("get string value as another type") {
givenConf getDouble "spline.decimalAsString" shouldEqual 1.2d
givenConf getInt "spline.integerAsString" shouldEqual 42
givenConf getBoolean "spline.booleanAsString" shouldEqual true
givenConf getDouble "spline.decimalAsString" shouldBe 1.2d
givenConf getInt "spline.integerAsString" shouldBe 42
givenConf getBoolean "spline.booleanAsString" shouldBe true
}

test("get non-string value as String") {
Expand All @@ -81,6 +81,12 @@ class YAMLConfigurationTest extends ReadOnlyConfigurationTest {
givenConf getString "spline.booleanAsBoolean" shouldEqual "true"
}

test("get non-string value as its own type") {
givenConf getDouble "spline.decimalAsNumber" shouldBe 1.2d
givenConf getInt "spline.integerAsNumber" shouldBe 42
givenConf getBoolean "spline.booleanAsBoolean" shouldBe true
}

test("get single-valued non-string property as List") {
givenConf getList "spline.decimalAsNumber" should contain theSameElementsAs Seq("1.2")
givenConf getList "spline.integerAsNumber" should contain theSameElementsAs Seq("42")
Expand Down

0 comments on commit 284696b

Please sign in to comment.