JUnit Testing Framework

Overview

Qualified supports writing tests for Kotlin using JUnit 4.

Basic Example

Solution

fun add(a: Int, b: Int) = a + b

Tests

import kotlin.test.assertEquals
import org.junit.Test

class TestAdd {
    @Test
    fun addTest() {
        assertEquals(2, add(1, 1))
    }
}

Assertion Libraries

Following assertion libraries can be used:

Learn More

You can learn more on the JUnit website.