Writing our first test with Kotlin

In this section, we will start with a slow introduction to test writing by creating a couple of simple tests. Locate your src/test directory and, under the com.journaler package, create a new class called NoteTest:

package com.journaler 
 
import org.junit.Test 
 
class NoteTest { 
 
    @Test 
    fun testNoteInsert(){ 
    } 
 
} 

We just defined an empty test that, at this point, doesn't do anything. Despite this, we introduced some very important things. We used the @Test annotation that will tell the test framework which method will represent test implementation. We are not limited to only one test per test class, so let's add a couple more tests in our test class:

package com.journaler import org.junit.Test class NoteTest { ...

Get Building Applications with Spring 5 and Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.