Java, Software Development, Spring, Spring Boot

Spring Boot – How to unit test RESTful API URLs

This post shows how to unit test RESTful API URLs using Spring Boot 1.5.10RELEASE. Sometimes, we want to ensure the list of URLs still work and match to what have been documented per specification.

Authenticate User – Controller

We have a simple controller that supposedly authenticates users. Notice we do not have the actual codes to perform the authentication. That’s fine!

When we test for only the URL, the implementation of a method does not matter.

Unit Test

Sample Output

Notice there is no text written from our controller.

Spring Boot Test RESTful API

Download the Codes


Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.

You Might Also Like