Skip to content

Commit e1f9882

Browse files
author
Oleg Michailov
committed
Adding basic unit tests
1 parent 6b65d56 commit e1f9882

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

library/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ apply plugin: 'maven-publish'
1515

1616
dependencies {
1717
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
18+
testCompile 'junit:junit:4.13'
1819
}
1920
repositories {
2021
mavenCentral()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.cesarferreira.pluralize
2+
3+
import org.junit.Assert.assertEquals
4+
import org.junit.Test
5+
6+
class PluralizationTest {
7+
8+
@Test
9+
fun `Should add default "s" suffix`() {
10+
assertEquals("posts", "post".pluralize())
11+
}
12+
13+
@Test
14+
fun `Should handle unCountable words`() {
15+
assertEquals("aircraft", "aircraft".pluralize())
16+
}
17+
18+
@Test
19+
fun `Should handle exception words`() {
20+
assertEquals("men", "man".pluralize())
21+
}
22+
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.cesarferreira.pluralize
2+
3+
import org.junit.Assert.assertEquals
4+
import org.junit.Test
5+
6+
class SingularizationTest {
7+
8+
@Test
9+
fun `Should remove default "s" suffix`() {
10+
assertEquals("word", "words".singularize())
11+
}
12+
13+
@Test
14+
fun `Should handle unCountable words`() {
15+
assertEquals("scissors", "scissors".singularize())
16+
}
17+
18+
@Test
19+
fun `Should handle exception words`() {
20+
assertEquals("person", "people".singularize())
21+
}
22+
23+
}

0 commit comments

Comments
 (0)