mirror of
https://github.com/lightbend/config.git
synced 2025-02-22 09:10:32 +08:00
Add a couple test cases for list1.withFallback(list2)
This commit is contained in:
parent
d4c3ca568a
commit
f87cde2ae3
@ -19,6 +19,7 @@ import com.typesafe.config.ConfigFactory
|
||||
import com.typesafe.config.ConfigMergeable
|
||||
import com.typesafe.config.ConfigRenderOptions
|
||||
import com.typesafe.config.ConfigSyntax
|
||||
import com.typesafe.config.ConfigValueFactory
|
||||
|
||||
class ConfigTest extends TestUtils {
|
||||
|
||||
@ -521,6 +522,25 @@ class ConfigTest extends TestUtils {
|
||||
assertTrue("a.c not found in: " + conf, conf.hasPath("a.c"))
|
||||
}
|
||||
|
||||
@Test
|
||||
def testNoMergeLists() {
|
||||
val conf = parseConfig("a: [1,2], a: [3,4]")
|
||||
assertEquals("lists did not merge", Seq(3, 4), conf.getIntList("a").asScala)
|
||||
}
|
||||
|
||||
@Test
|
||||
def testListsWithFallback() {
|
||||
val list1 = ConfigValueFactory.fromIterable(Seq(1, 2, 3).asJava)
|
||||
val list2 = ConfigValueFactory.fromIterable(Seq(4, 5, 6).asJava)
|
||||
val merged1 = list1.withFallback(list2)
|
||||
val merged2 = list2.withFallback(list1)
|
||||
assertEquals("lists did not merge 1", list1, merged1)
|
||||
assertEquals("lists did not merge 2", list2, merged2)
|
||||
assertFalse("equals is working on these", list1 == list2)
|
||||
assertFalse("equals is working on these", list1 == merged2)
|
||||
assertFalse("equals is working on these", list2 == merged1)
|
||||
}
|
||||
|
||||
@Test
|
||||
def integerRangeChecks() {
|
||||
val conf = parseConfig("{ tooNegative: " + (Integer.MIN_VALUE - 1L) + ", tooPositive: " + (Integer.MAX_VALUE + 1L) + "}")
|
||||
|
Loading…
Reference in New Issue
Block a user