Kotlin Notes
My notes on Kotlin and libraries associated with Kotlin. Notes in the public.
Concepts
TBD
New Function Types
- Extension functions
- Scoped functions
Libraries
mockk
kotest
Kotlin testing library alternative to JUnit. Testing Framework, Assertion Library and Property Testing.
Notes:
- Unlike JUnit, by default when tests are run, each class is instantiated and
each test is run. This means, for example,
mockk
instances aren’t reset between tests. - Different testing styles
// Annotation Spec (similar to JUnit)
class AnnotationSpecExample : AnnotationSpec() {
@BeforeEach
fun beforeTest() {
println("Before each test")
}
@Test
fun test1() {
1 shouldBe 1
}
@Test
fun test2() {
3 shouldBe 3
}
}