Unit testing of the Messages App

In Chapter 2Vue.js 2 – It Works in the Way You Expected, we created a Messages App that has an API to retrieve all of the messages that are received. In this section, we will write unit testing code in that application to test that API.

Before writing any test code, we need to add spring-boot-starter-test in the Message App's pom.xml file, as shown in the following code. Let's have a look at the pom.xml file:

<project>  ...  <dependencies>    ...    <!-- Test -->    <dependency>      <groupId>org.springframework.boot</groupId>      <artifactId>spring-boot-starter-test</artifactId>      <scope>test</scope>    </dependency>  </dependencies>  ...</project> 

For this dependency, we use a test scope so that the related dependencies won't be ...

Get Building Applications with Spring 5 and Vue.js 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.