Replace mark as known page with Kotlin version
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / utils / StringsTest.kt
1 package net.pterodactylus.sone.utils
2
3 import org.hamcrest.MatcherAssert.assertThat
4 import org.hamcrest.Matchers.equalTo
5 import org.hamcrest.Matchers.nullValue
6 import org.junit.Test
7
8 /**
9  * Unit test for [StringsKt].
10  */
11 class StringsTest {
12
13         @Test
14         fun `non-empty string is returned as-is`() {
15                 assertThat("non-empty".emptyToNull, equalTo("non-empty"))
16         }
17
18         @Test
19         fun `string with whitespace only is returned as null`() {
20                 assertThat("   ".emptyToNull, nullValue())
21         }
22
23         @Test
24         fun `zero-length string is returned as null`() {
25                 assertThat("".emptyToNull, nullValue())
26         }
27
28         @Test
29         fun `null is returned as null`() {
30                 assertThat(null.emptyToNull, nullValue())
31         }
32
33 }