Testing Spring REST applications
In this section, we will continue towards test implementation and will be testing Spring-specific topics. First of all, we will specify the SprintRunner
class, which is going to be used as the test runner for our tests:
package com.journaler import org.junit.After import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.springframework.test.context.junit4.SpringRunner @RunWith(SpringRunner::class) class NoteTest { ... }
By annotating @RunWith(SpringRunner::class)
, we specified that SpringRunner
will be used for test running and will be initializing TestContextManager
to provide Spring testing functionality to standard tests. Let's run the test once more. Observe the output in the following screenshot:

As you can see, Spring Framework is being used to support the test we just run.
As we already know, the NoteTest
class doesn't have any implementation. We will test the Service layer of our application, and we will...