mirror of
https://github.com/Anvilcraft/modpacktools
synced 2024-05-19 20:04:07 +02:00
rename tests
This commit is contained in:
parent
e67995d6a0
commit
e838e48f42
|
@ -6,13 +6,13 @@ import java.io.ByteArrayOutputStream
|
|||
import java.io.PrintStream
|
||||
|
||||
class CLIUtilTest {
|
||||
fun prntStr(f: PrintStream.() -> Unit): String =
|
||||
private fun prntStr(f: PrintStream.() -> Unit): String =
|
||||
ByteArrayOutputStream().apply {
|
||||
PrintStream(this, true, "UTF-8").use(f)
|
||||
}.use {it.toString("UTF-8")}
|
||||
|
||||
@Test
|
||||
fun testFPrintln() {
|
||||
fun fPrintLn() {
|
||||
assertEquals(
|
||||
"Test String Formatted\n",
|
||||
prntStr {this.fPrintln("Test String", {"$it Formatted"})}
|
||||
|
@ -20,7 +20,7 @@ class CLIUtilTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun testFPrintlnNull() {
|
||||
fun `fPrintLn with null`() {
|
||||
assertEquals(
|
||||
"null\n",
|
||||
prntStr {this.fPrintln(null)}
|
||||
|
|
|
@ -8,13 +8,13 @@ import java.net.URL
|
|||
|
||||
class UtilTest {
|
||||
@Test
|
||||
fun testSanitize() = assertEquals(URL("https://example.com/test%20test"), URL("https://example.com/test test").sanitize())
|
||||
fun sanitize() = assertEquals(URL("https://example.com/test%20test"), URL("https://example.com/test test").sanitize())
|
||||
|
||||
@Test
|
||||
fun testMergeTo() = assertEquals(File("testing/dir"), File("testing") mergeTo File("dir"))
|
||||
fun mergeTo() = assertEquals(File("testing/dir"), File("testing") mergeTo File("dir"))
|
||||
|
||||
@Test
|
||||
fun testReadAsJson() {
|
||||
fun readAsJson() {
|
||||
val tmpDir = TemporaryFolder().apply {create()}
|
||||
val testFile = tmpDir.newFile()
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.junit.Assert.assertNull
|
|||
import org.junit.Test
|
||||
|
||||
class ConfigTomlTest {
|
||||
val toml = ConfigToml().read(
|
||||
private val toml = ConfigToml().read(
|
||||
"""
|
||||
[SomeCategory]
|
||||
someValue = 123
|
||||
|
@ -13,7 +13,7 @@ class ConfigTomlTest {
|
|||
) as ConfigToml
|
||||
|
||||
@Test
|
||||
fun testGetPath() {
|
||||
fun getPath() {
|
||||
//String getPath
|
||||
assertEquals(
|
||||
123L,
|
||||
|
@ -22,19 +22,22 @@ class ConfigTomlTest {
|
|||
|
||||
//should be null if invalid category
|
||||
assertNull(toml.getPath("NonExistentCategory/val"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getPath with invalid path`() {
|
||||
//should be null if invalid value
|
||||
assertNull(toml.getPath("SomeCategory/val"))
|
||||
}
|
||||
|
||||
//should throw exception
|
||||
@Test(expected = MissingConfigValueException::class)
|
||||
fun testPathOrExceptionMissing() {
|
||||
fun `pathOrException with invalid path`() {
|
||||
toml.pathOrException<Long>("Asd/asd")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPathOrException() {
|
||||
fun pathOrException() {
|
||||
assertEquals(
|
||||
123L,
|
||||
toml.pathOrException("SomeCategory/someValue")
|
||||
|
|
Loading…
Reference in a new issue