HOME > Development > JUnit and Mockito Unit Testing for Java Developers

JUnit and Mockito Unit Testing for Java Developers

  • Development
  • May 05, 2025
SynopsisJUnit and Mockito Unit Testing for Java Developers, available...
JUnit and Mockito Unit Testing for Java Developers  No.1

JUnit and Mockito Unit Testing for Java Developers, available at $44.99, has an average rating of 4.15, with 68 lectures, based on 58 reviews, and has 276 subscribers.

You will learn about Be able to write unit tests confidently using JUnit Appreciate mocking and mock objects and understand how to test interactions with Mockito Be able to use Mockito to create test fixtures, stub methods by programmatic and annotation-driven test setup Understand how to analyse production code to guide writing unit tests Gain an appreciation of the JUnit Assertions API and be able to write assertions using that and Hamcrest, the popular assertions library shipped with JUnit Understand modern unit testing concepts and best practices This course is ideal for individuals who are Developers who want to know how to write unit tests using JUnit, Mockito and Hamcrest or Testers who want to better understand testing theory and be able to write their own unit tests out of interest or Anyone who is hungry to learn all about the craft of writing better unit tests and understanding this from the ground up! It is particularly useful for Developers who want to know how to write unit tests using JUnit, Mockito and Hamcrest or Testers who want to better understand testing theory and be able to write their own unit tests out of interest or Anyone who is hungry to learn all about the craft of writing better unit tests and understanding this from the ground up!.

Enroll now: JUnit and Mockito Unit Testing for Java Developers

Summary

Title: JUnit and Mockito Unit Testing for Java Developers

Price: $44.99

Average Rating: 4.15

Number of Lectures: 68

Number of Published Lectures: 68

Number of Curriculum Items: 68

Number of Published Curriculum Objects: 68

Original Price: $89.99

Quality Status: approved

Status: Live

What You Will Learn

  • Be able to write unit tests confidently using JUnit
  • Appreciate mocking and mock objects and understand how to test interactions with Mockito
  • Be able to use Mockito to create test fixtures, stub methods by programmatic and annotation-driven test setup
  • Understand how to analyse production code to guide writing unit tests
  • Gain an appreciation of the JUnit Assertions API and be able to write assertions using that and Hamcrest, the popular assertions library shipped with JUnit
  • Understand modern unit testing concepts and best practices
  • Who Should Attend

  • Developers who want to know how to write unit tests using JUnit, Mockito and Hamcrest
  • Testers who want to better understand testing theory and be able to write their own unit tests out of interest
  • Anyone who is hungry to learn all about the craft of writing better unit tests and understanding this from the ground up!
  • Target Audiences

  • Developers who want to know how to write unit tests using JUnit, Mockito and Hamcrest
  • Testers who want to better understand testing theory and be able to write their own unit tests out of interest
  • Anyone who is hungry to learn all about the craft of writing better unit tests and understanding this from the ground up!
  • Do you want to get hands on demonstrations of JUnit and Mockito in action, want a simple no-fluff guide to how unit testing works including getting an understanding of best practices along the way?

    Are you struggling to understand unit testing and would like a friendly guide to help you understand it all completely from the ground up?

    Maybe you’re a junior Java developer who is just starting out and you need a hands-on guide to JUnit and Mockito unit testing to get up and running quickly?

    Or you might be an old hand at Java who has been out of practice and needs to level up your unit testing and JUnit and Mockito knowledge ready for a new project?

    Then this course is for you!

    We cover the following themes:

  • Foundations –this is all the good stuff that’s been distilled down through the years – it’s best practices and gets you up and running with knowing the stuff the APIs don’t tell you

  • Installation and Set Up / Project Creation– we get you creating a project which uses JUnit and introduce you to the project structure and conventions you need to know

  • Writing Tests with JUnit– we cover exactly how to write unit tests with JUnit in this section and get a feel for the API together, covering best practices and how JUnit works along the way

  • Writing mock objects based unit tests with Mockito– we cover a quick start on getting up and running with Mockito to test a simple layered architecture you might find in a webapp (also coding the presentation, business and data layers in preparation to demonstrate this too!) then we demonstrate using Mockito to write tests for it

  • Using the Hamcrest assertions library – we cover how you can do more powerful assertions in your unit tests by harnessing the power of the Hamcrest assertions library that comes shipped with JUnit.

  • And the following topics:

  • Arrange/Act/Assert

  • Assertions

  • Testing Conventions

  • Good test characteristics

  • Java project structure

  • Creating a JUnit project with Maven

  • Running unit tests in the IDE

  • Test failures

  • JUnit’s fail fast mechanism

  • JUnit’s annotations

  • Test fixtures

  • Mock objects and their use in unit testing

  • Mockito basics

  • Layered architecture principles

  • Testing a simple layered architecture with Mockito and JUnit

  • Understanding the different types of assertions

  • Using the JUnit Assertions API and Hamcrest

  • Using Hamcrest matchers

  • Composing Hamcrest matchers and creating complex, yet readable assertions

  • Reading Hamcrest test failures

  • Analysing the production code to guide you to writing unit tests

    and much, much more!

  • This course takes you straight from the beginning and gets you up and running to be fully proficient at writing unit tests using JUnit, Mockito and Hamcrest in quick time. Maybe you’ve started a new job where they use it to test their applications, or you’re learning industry-standard tools to better place you ahead of the competition or you just want to ramp up your unit testing knowledge quickly in a no-fuss guide – then this course is for you!

    Ultimately, by unlocking the mechanics of how JUnit and Mockito work in front of your eyes, you should be able to better test your Java projects with the frameworks and have fun doing so!

    I look forward to teaching you all about JUnit, Mockito and unit testing inside! 馃槈

    Course Curriculum

    Chapter 1: Introduction

    Lecture 1: Welcome to the Course!

    Lecture 2: How to get help and support

    Lecture 3: Overview of the Course Structure

    Lecture 4: A quick welcome and note on the course format

    Chapter 2: Unit Testing Foundations

    Lecture 1: Section introduction

    Lecture 2: What is Unit Testing?

    Lecture 3: What is JUnit?

    Lecture 4: Introducing a Simple Unit Test in JUnit

    Lecture 5: Structure of a Unit Test (Arrange-Act-Assert and Given/When/Then)

    Lecture 6: Conventions for Writing Unit Tests

    Lecture 7: Characteristics of Proper Unit Tests

    Lecture 8: What are Assertions?

    Chapter 3: Creating a Java Project which uses JUnit

    Lecture 1: Section introduction

    Lecture 2: Creating a Java project which includes JUnit using the Maven Quickstart Archetyp

    Lecture 3: Introducing a typical Java project structure (production vs test source trees)

    Lecture 4: Understanding the basic conventions for creating unit tests (package and naming

    Chapter 4: Writing and Running Unit Tests with JUnit and IntelliJ IDEA

    Lecture 1: Section introduction

    Lecture 2: Creating a test method with the @Test annotation

    Lecture 3: Running a unit test within the IDE and understanding test success

    Lecture 4: Understanding test failures with exceptions

    Lecture 5: Failing a unit tests explicitly with Assert.fail

    Lecture 6: Using Assert.fail to check validation logic in a try/catch

    Lecture 7: An introduction to the JUnit Assertions API

    Lecture 8: Structuring unit tests with Arrange/Act/Assert

    Lecture 9: Understanding execution of assertions and JUnits fail-fast test failure mechani

    Lecture 10: Adding descriptive comments to assertions and test failures to aid diagnostics

    Lecture 11: Coding a unit test following Arrange-Act-Assert

    Lecture 12: Keeping test setup DRY with @Before

    Lecture 13: Understanding test fixture instantiation

    Chapter 5: Unit Testing with Mock Objects and Mockito

    Lecture 1: Section introduction

    Lecture 2: What is Mockito and what are mock objects?

    Lecture 3: Introduction to testing with mock objects

    Lecture 4: Configuring Projects to Use Mockito

    Lecture 5: Creating a project which uses JUnit and Mockito

    Lecture 6: Coding a Layered Architecture – Presentation Layer

    Lecture 7: Coding a Layered Architecture – Business Layer

    Lecture 8: Coding a Layered Architecture – Persistence Layer

    Lecture 9: Putting the correct packages in place to respect the layering

    Lecture 10: Writing a test for the Login Controller in the presentation layer

    Lecture 11: Understanding the test fixture setup when writing mock object based unit tests

    Lecture 12: Writing a test for the Authentication Service in the business layer

    Lecture 13: Thinking about design decisions when unit testing

    Chapter 6: Looking at the Hamcrest Assertions Library

    Lecture 1: Section Introduction

    Lecture 2: Evolving the Domain and Repository Classes

    Lecture 3: Ignoring Tests with @ignore

    Lecture 4: Implementing a Finder in the Repository

    Lecture 5: Implementing Business Logic in the Service

    Lecture 6: Configuring Maven to use Java 8

    Lecture 7: Evolving the Repository Class

    Lecture 8: Adding a Parameter-driven Finder to the Service

    Lecture 9: Refactoring to Evolve a New Service

    Lecture 10: Generating Test Methods in the IDE and Toggling Between Production and Test Code

    Lecture 11: Introducing the JUnit Mockito Runner and @Mock

    Lecture 12: Analyzing the Production Code to Determine How to Write the Arrange Section

    Lecture 13: Using Mockitos @InjectMocks to Create the System Under Test with its Dependenc

    Lecture 14: Keep Yourself Motivated by Checking the Happy Path Test Output

    Lecture 15: Using the JUnit Assertions API to write the Assert Section

    Lecture 16: Thinking About the Weaknesses of the JUnit Assertions API

    Lecture 17: The Importance of Checking Your Work as you Go!

    Lecture 18: Upgrading a JUnit project to use the full Hamcrest version

    Lecture 19: Replacing JUnit assertions with Hamcrest assertions and using assertions with co

    Lecture 20: Understanding and Reading Hamcrest Test Failures

    Lecture 21: Quick thoughts on Hamcrest individual vs collection Assertions

    Lecture 22: Dont invoke unneeded production code in your test classes

    Lecture 23: Understanding Evaluation of Hamcrest Matchers

    Lecture 24: Thinking about why we keep production code to a minimum in tests

    Lecture 25: Creating Complex Hamcrest Assertions with allOf and Property Matchers

    Chapter 7: Wrapping Up!

    Lecture 1: Bonus: Taking your Java knowledge further

    Instructors

  • JUnit and Mockito Unit Testing for Java Developers  No.2
    Matt Speake
    Java Technologist and Trainer
  • JUnit and Mockito Unit Testing for Java Developers  No.3
    Java Easily
    Learn Java. Easily.
  • Rating Distribution

  • 1 stars: 1 votes
  • 2 stars: 2 votes
  • 3 stars: 9 votes
  • 4 stars: 21 votes
  • 5 stars: 25 votes
  • Frequently Asked Questions

    How long do I have access to the course materials?

    You can view and review the lecture materials indefinitely, like an on-demand channel.

    Can I take my courses with me wherever I go?

    Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don’t have an internet connection, some instructors also let their students download course lectures. That’s up to the instructor though, so make sure you get on their good side!