Skip to content

Commit 88b050a

Browse files
committed
updated docs
1 parent f4b9076 commit 88b050a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

exercise-5.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Let's start out by finally adding a simple unit test. Normally of course we woul
88

99
In the `src/main/test` folder the file BootiqueControllerTest should be available. It has no contents yet, this is left for you to provide.
1010

11-
We are going to be using a mocking framework to mock our dependencies. Spring Boot conveniently bundles Mockito so let's use that. First thing to do now, is to add the MockitoExtension to the test class. This would look something like the listing below.
11+
We are going to be using a mocking framework to mock our dependencies. Spring Boot bundles Mockito but for Kotlin applications there are other alternatives like MockK/SpringMockK. Since the Java version was using Mockito, lets use that for now. First thing to do now, is to add the MockitoExtension to the test class. This would look something like the listing below.
1212

1313
```kotlin
1414
import org.junit.jupiter.api.Test
@@ -156,7 +156,8 @@ You can also add a useful library to your codebase named [mockito-kotlin](https:
156156

157157
### Write an application test
158158

159-
We are going to test the app by calling an endpoint, so we'll be modifying the test. We are first going to tell Spring Boot to start a server (on a random port) and will wire in a TestRestTemplate to call the service.
159+
Spring provides multiple different ways of testing your application code. For example, you could test you web layer in isolation by using @WebMvcTest. But you can also bootstrap your entire Spring Boot application using a @SpringBootTest.
160+
In this exercise we are going to test our Spring Boot application using @SpringBootTest by calling an endpoint from our test case, so we'll be modifying the test for this. We are first going to tell Spring Boot to start a server (on a random port) and will wire in a TestRestTemplate to call the service.
160161

161162
First, we'll need to configure the web environment to test against. Modify the `@SpringBootTest` annotation like below.
162163

0 commit comments

Comments
 (0)