Testing Spring Boot Applications
Learn Testing Spring Boot Applications (Testing, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Unit Test vs Integration Test Testing a Spring Boot application happens at two very different levels: 1. Unit Test • Tests one class in isolation - for example, just a service class. • Any dependency the class needs is faked (mocked) so no real database, no real Spring context, no real network call happens. • Very fast, because nothing heavy is loaded. 2. Integration Test • Tests the whole wired application (or a large slice of it) - Spring actually creates the beans, wires them together, and everything runs as it would in production. • Slower, because the Spring context has to start up. •...