-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test for
capitalize
and trimToNull
Signed-off-by: Arnau Mora <[email protected]>
- Loading branch information
1 parent
932b816
commit 279db1f
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package at.bitfire.vcard4android | ||
|
||
import at.bitfire.vcard4android.Utils.capitalize | ||
import at.bitfire.vcard4android.Utils.trimToNull | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Assert.assertNull | ||
import org.junit.Test | ||
|
||
class UtilsTest { | ||
@Test | ||
fun testCapitalize() { | ||
assertEquals("Utils Test", "utils test".capitalize()) // Test multiple words | ||
assertEquals("Utils", "utils".capitalize()) // Test single word | ||
assertEquals("", "".capitalize()) // Test empty string | ||
} | ||
|
||
@Test | ||
fun testTrimToNull() { | ||
assertEquals("test", " test".trimToNull()) // Test spaces only before | ||
assertEquals("test", "test ".trimToNull()) // Test spaces only after | ||
assertEquals("test", " test ".trimToNull()) // Test spaces before and after | ||
assertNull(" ".trimToNull()) // Test spaces | ||
assertNull("".trimToNull()) // Test empty string | ||
} | ||
} |