All the tests are put in the test module with the same package name of the code. Mainly the test cases are written for the Controller, but you can even write for Repository for which you'll need to mock the database using Mockito or some other mocking library.
The MockMvc class is the entry point for performing server-side tests. We can perform HTTP requests such as GET, POST, and others on the URLs to test the REST endpoints.
MessageControllerTests: Test cases for the MessageController are written in human readable names using ` while writing function names.
Consider the following example:
@RunWith(SpringRunner::class) @SpringBootTest class MessageControllerTests { @Autowired lateinit var context: WebApplicationContext @Autowired ...