Add StringUtilsTest

bzip2
Graham 5 years ago
parent d2460c68ba
commit ef9e61de33
  1. 4
      util/pom.xml
  2. 21
      util/src/test/java/dev/openrs2/util/StringUtilsTest.java

@ -27,5 +27,9 @@
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -0,0 +1,21 @@
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(""));
}
}
Loading…
Cancel
Save