From 09141e451ade693ec1c84c1c755406e775954489 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 15 Dec 2019 16:38:03 +0000 Subject: [PATCH] Convert StringUtilsTest to Kotlin --- .../dev/openrs2/util/StringUtilsTest.java | 22 ----------------- .../java/dev/openrs2/util/StringUtilsTest.kt | 24 +++++++++++++++++++ 2 files changed, 24 insertions(+), 22 deletions(-) delete mode 100644 util/src/test/java/dev/openrs2/util/StringUtilsTest.java create mode 100644 util/src/test/java/dev/openrs2/util/StringUtilsTest.kt diff --git a/util/src/test/java/dev/openrs2/util/StringUtilsTest.java b/util/src/test/java/dev/openrs2/util/StringUtilsTest.java deleted file mode 100644 index 90a04219..00000000 --- a/util/src/test/java/dev/openrs2/util/StringUtilsTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.openrs2.util; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - -public final class StringUtilsTest { - @Test - public void testIndefiniteArticle() { - assertEquals("a", StringUtils.indefiniteArticle("book")); - assertEquals("an", StringUtils.indefiniteArticle("aeroplane")); - - assertThrows(IllegalArgumentException.class, () -> StringUtils.indefiniteArticle("")); - } - - @Test - public void testCapitalize() { - assertEquals("Hello", StringUtils.capitalize("hello")); - assertEquals("", StringUtils.capitalize("")); - } -} diff --git a/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt b/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt new file mode 100644 index 00000000..d63374e6 --- /dev/null +++ b/util/src/test/java/dev/openrs2/util/StringUtilsTest.kt @@ -0,0 +1,24 @@ +package dev.openrs2.util + +import dev.openrs2.util.StringUtils.capitalize +import dev.openrs2.util.StringUtils.indefiniteArticle +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith + +object StringUtilsTest { + @Test + fun testIndefiniteArticle() { + assertEquals("a", indefiniteArticle("book")) + assertEquals("an", indefiniteArticle("aeroplane")) + assertFailsWith(IllegalArgumentException::class) { + indefiniteArticle("") + } + } + + @Test + fun testCapitalize() { + assertEquals("Hello", capitalize("hello")) + assertEquals("", capitalize("")) + } +}