JUnit and Mockito Unit Testing for Java Developers

Master how to use JUnit to unit test Java applications using JUnit, Mockito and Hamcrest!
  • 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 characteristicsJava 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

Matt Speake

Principal instructor at JavaEasily teaching all about different aspects of Java tech for beginners and intermediate developers.  

Check out the JavaEasily Youtube channel, follow us on Facebook and Twitter too!


Great explanations and step by step guiding. I'm glad I've chosen this course.

Course Pricing

  • Standard Course Purchase
  • $67 USD

    Buy Now