Convert StringUtilsTest to Kotlin

master
Graham 5 years ago
parent 4e4d2daa1e
commit 09141e451a
  1. 22
      util/src/test/java/dev/openrs2/util/StringUtilsTest.java
  2. 24
      util/src/test/java/dev/openrs2/util/StringUtilsTest.kt

@ -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(""));
}
}

@ -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(""))
}
}
Loading…
Cancel
Save