Skip to content

Instantly share code, notes, and snippets.

@sliskiCode
Last active November 4, 2016 15:20
Show Gist options
  • Save sliskiCode/f9520a3bec10e367437df778abae052e to your computer and use it in GitHub Desktop.
Save sliskiCode/f9520a3bec10e367437df778abae052e to your computer and use it in GitHub Desktop.
Deep dive in Kotlin extensions 1
import org.junit.Assert.assertEquals
import org.junit.Test
fun String.removeWhitespaces() = replace(" ", "")
class StringKtTest {
@Test fun removesWhitespacesFromString() {
val tested = "Piotr Slesarew"
val actual = tested.removeWhitespaces()
val expected = "PiotrSlesarew"
assertEquals(expected, actual)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment