mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-19 05:51:51 +01:00
Add tests for setPropertyString
This commit is contained in:
parent
68717d592c
commit
34ea244e82
@ -61,7 +61,7 @@ class WorldConfigTest : TestWithMockBukkit() {
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("alias", "abc").isSuccess)
|
||||
assertEquals("abc", worldConfig.stringPropertyHandle.getProperty("alias").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("scale", "2.0").isSuccess)
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("scale", 2.0).isSuccess)
|
||||
assertEquals(2.0, worldConfig.stringPropertyHandle.getProperty("scale").get())
|
||||
|
||||
val blacklists = listOf("a", "b", "c")
|
||||
@ -72,6 +72,25 @@ class WorldConfigTest : TestWithMockBukkit() {
|
||||
assertEquals(Material.JUNGLE_WOOD, worldConfig.stringPropertyHandle.getProperty("entryfee-currency").get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating an existing world property with setPropertyString reflects the changes in getProperty`() {
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("adjust-spawn", "true").isSuccess)
|
||||
assertEquals(true, worldConfig.stringPropertyHandle.getProperty("adjust-spawn").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("alias", "abc").isSuccess)
|
||||
assertEquals("abc", worldConfig.stringPropertyHandle.getProperty("alias").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("scale", "2.0").isSuccess)
|
||||
assertEquals(2.0, worldConfig.stringPropertyHandle.getProperty("scale").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("world-blacklist", "a,b,c").isSuccess)
|
||||
assertEquals(listOf("a", "b", "c"), worldConfig.stringPropertyHandle.getProperty("world-blacklist").get())
|
||||
|
||||
assertTrue(worldConfig.stringPropertyHandle.setPropertyString("entryfee-currency", "jungle_wood").isSuccess)
|
||||
assertEquals(Material.JUNGLE_WOOD, worldConfig.stringPropertyHandle.getProperty("entryfee-currency").get())
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun `Updating a non-existing property with setProperty returns false`() {
|
||||
assertTrue(worldConfig.stringPropertyHandle.setProperty("invalid-property", false).isFailure)
|
||||
|
@ -22,7 +22,7 @@ world_nether:
|
||||
portal-form: ALL
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
scale: 8.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVNullLocation (It's a bug if you see this in your config file)
|
||||
|
@ -61,7 +61,7 @@ world_nether:
|
||||
portal-form: ALL
|
||||
pvp: true
|
||||
respawn-world: ''
|
||||
scale: 1.0
|
||||
scale: 8.0
|
||||
seed: -9223372036854775808
|
||||
spawn-location:
|
||||
==: MVNullLocation (It's a bug if you see this in your config file)
|
||||
|
Loading…
Reference in New Issue
Block a user