Rename test methods.

This commit is contained in:
Jeremy Wood 2023-03-27 09:51:27 -04:00
parent 55390952c9
commit 9bbf42f993
No known key found for this signature in database
GPG Key ID: C5BAD04C77B91B4B

View File

@ -36,7 +36,7 @@ class ConfigTest : TestWithMockBukkit() {
} }
@Test @Test
fun `Config migration`() { fun `Old config is migrated`() {
val oldConfig = getResourceAsText("/old_config.yml") val oldConfig = getResourceAsText("/old_config.yml")
assertNotNull(oldConfig) assertNotNull(oldConfig)
File(Path.of(multiverseCore.dataFolder.absolutePath, "config.yml").absolutePathString()).writeText(oldConfig) File(Path.of(multiverseCore.dataFolder.absolutePath, "config.yml").absolutePathString()).writeText(oldConfig)
@ -58,20 +58,25 @@ class ConfigTest : TestWithMockBukkit() {
} }
@Test @Test
fun `Get valid property`() { fun `Getting existing config property with getProperty returns expected value`() {
assertEquals(false, config.getProperty("enforce-access")) assertEquals(false, config.getProperty("enforce-access"))
assertEquals("world", config.getProperty("first-spawn-location")) assertEquals("world", config.getProperty("first-spawn-location"))
assertEquals(3, config.globalDebug)
} }
@Test @Test
fun `Get invalid property`() { fun `Getting non-existing config property with getProperty returns null`() {
assertNull(config.getProperty("invalid-property")) assertNull(config.getProperty("invalid-property"))
assertNull(config.getProperty("version")) assertNull(config.getProperty("version"))
} }
@Test @Test
fun `Set valid property`() { fun `Getting existing config property by getter returns expected value`() {
assertEquals(false, config.enforceAccess)
assertEquals("world", config.firstSpawnLocation)
}
@Test
fun `Updating an existing config property with setProperty reflects the changes in getProperty`() {
assertTrue(config.setProperty("enforce-access", true)) assertTrue(config.setProperty("enforce-access", true))
assertEquals(true, config.getProperty("enforce-access")) assertEquals(true, config.getProperty("enforce-access"))
@ -83,7 +88,7 @@ class ConfigTest : TestWithMockBukkit() {
} }
@Test @Test
fun `Set invalid property`() { fun `Updating a non-existing property with setProperty returns false`() {
assertFalse(config.setProperty("invalid-property", false)) assertFalse(config.setProperty("invalid-property", false))
assertFalse(config.setProperty("version", 1.1)) assertFalse(config.setProperty("version", 1.1))
} }