From the course: Extending, Securing, and Dockerizing Spring Boot Microservices
Unlock the full course today
Join today to access over 23,300 courses taught by industry experts.
Unit testing with Mockito vs. integration testing
From the course: Extending, Securing, and Dockerizing Spring Boot Microservices
Unit testing with Mockito vs. integration testing
- (Narrator) Frequent feedback I receive from learners about creating your first Spring Boot RESTful Microservice, was that it lacked Unit tests, I couldn't agree more. The goal of this course was to introduce several Spring frameworks, not to test them. However, it was difficult to shake that developer shame. Because I truly believe that, "Code isn't code unless it has code to test the code." So it is with great satisfaction, and sense of redemption that I present TESTS. I'm assuming you already know how to create and configure JUnit tests with Spring, but if not I suggest you check out Shana Smith's " Spring: Test-Driven Development with Junit" in the learning library. A Unit test will test a class in isolation, meaning to test only the code in the class, not its dependencies An integration test will invoke not just the class, but also its underlying dependencies. In the exercise files of this chapter, there are several Unit tests, but I want to focus on testing Tour Rating Service…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.