Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Testing java spring apps with JUNIT, Mockito, Wiremock
Rating: 4.5 out of 5(9 ratings)
205 students

Testing java spring apps with JUNIT, Mockito, Wiremock

Advance your career by learning how to make your code bulletproof by using available testing means
Created byGeorge Covrig
Last updated 12/2023
English
English [Auto],

What you'll learn

  • Learn to write high quality code
  • Learn JUNIT
  • Learn Wiremock
  • Learn Postman testing
  • Spring

Course content

3 sections19 lectures7h 59m total length
  • JUNIT5 introduction and practical example34:50

    Discover JUnit 5, a versatile testing framework, using annotations like @Test and @BeforeAll to build reliable tests; follow a practical average calculation example with assertions and exception handling.

  • Mockito, Stub, Spy presentation9:19

    Explore the differences between mock, spy, and stub using the mosquito library to mock dependencies, provide hardcoded responses, and verify method calls in tests.

  • Presentation and implementation of the flow29:13

    Learn to design and test an airport management flow with mock and spy testing using JUnit, Mockito, and WireMock, from pilot and plane services to control tower and notification service.

  • Mockito, Spy, Stub on the previously implemented app44:36

    Showcases testing of Java Spring apps using G-Unit, mosquito mocks, stubs, and spies, detailing test setup, mock behavior, and verification of interactions in a flight scenario.

  • Mocking exceptions27:16

    Learn how to mock exceptions in Java Spring tests, verify rollback flows across pilot, plane, and control tower services, and ensure correct calls when exceptions occur.

  • Exception testing by using spies36:54

    Explore exception testing with spies in java spring apps, force spies to throw exceptions, forward them through prepare flight, and reset mocks to verify pilot, plane, and control tower services.

  • Wiremock introduction6:13

    Learn how to use wiremock to mock rest api calls, replacing hardcoded data with simulated external services, and verify requests and responses in Java Spring app tests.

  • Presentation and implementation of the flow part 244:14

    In this flow part 2, implement the control tower check, simulate takeoff approvals with a map, and orchestrate pilots, planes, and notifications using mocks and spies, with rollback handling.

  • Reset mocks3:20

    Reset mocks to prevent cross-test contamination in JUnit, Mockito, and WireMock, and understand how static mocks retain interactions and affect verifications.

  • Mockito, Spy, Stub in Spring - preparing the workspace19:31

    Learn to scaffold a Spring app with Spring initializer, configure Maven, annotate components with @Component and @Autowired, and expose a rest API for preparing a flight.

  • Mockito, Spy, Stub in Spring - tests implementing12:32

    Declare mocks and spies in spring tests with @Mock, @Spy, and @InjectMocks, inject them into the command center service, and verify test flows with spring-based testing.

Requirements

  • You can understand 70% of the course by knowing Java basic
  • To understand the spring lessons, you need some knowledge of it too

Description

"Testing Java Apps with JUnit, Mockito, Wiremock, and Postman" is a course designed for Java developers who want to improve their skills in creating robust, high-quality software. It covers the use of JUnit, a popular Java framework for unit testing, along with the Mockito and Wiremock libraries for creating mock objects and simulating HTTP interactions. Additionally, the course covers the use of Postman for testing and debugging RESTful API's. Throughout the course, you will learn how to write test cases that are easy to maintain, understand and execute. The course will also cover the best practices and common pitfalls to avoid when testing Java applications. By the end of the course, you will have the knowledge and skills needed to confidently create, execute, and maintain automated tests for your Java applications.


You will learn about :

  • JUNIT concepts - we first write the code for our app, then we identify what is missing to be proud of our code and at the end of this chapter we implement some tests that will cover all our functionality.

  • how to use POSTMAN to write automated tests and also build your own mock server. POSTMAN is used, most of the times, just for making requests to our app, but in reality it has a lot of functionality that can make your life easier

  • Mockito - we will talk about stubs/spies/mocks. We first write some tests that will use stub/mock/spy for the simple java app and after that we learn what changes in our approach. You will need this information to know exactly when to use what.

  • Wiremock - you will learn how to an app that uses a rest api client

These are must know knowledge if you want to advance your career and write better code.


Who this course is for:

  • People that want to improve their coding skills