Mastering Java & Spring Framework Essentials Bundle

4 Courses & 11 Hours
$24.99$800.00
You save 96% -

What's Included

JUnit & Mockito Unit Testing for Java Developers
  • Certification included
  • Experience level required: Beginner
  • Access 61 lectures & 2 hours of content 24/7
  • Length of time users can access this course: Lifetime

Course Curriculum

61 Lessons (2h)

  • Your First Program
  • Unit Testing Foundations
    Overview of the Course Structure1:34
    What is Unit Testing?2:45
    Introducing a Simple Unit Test in JUnit3:02
    Structure of a Unit Test5:08
    Conventions for Writing Unit Tests2:41
    Characteristics of Proper Unit Tests5:48
  • Creating a Java Project which uses JUnit
    01 - Section Introduction0:49
    Creating a Java project which includes JUnit using the Maven Quickstart Archetype2:51
    Introducing a typical Java project structure (production vs test source trees)2:47
    Understanding the basic conventions for creating unit tests (package and naming conventions)3:42
    01 - Section Introduction0:36
  • Writing and Running Unit Tests with JUnit and IntelliJ IDEA
    Section Introduction0:52
    Creating a test method with the @Test annotation1:39
    Running a unit test within the IDE and understanding test success1:21
    Understanding test failures with exceptions2:21
    Failing a unit test explicitly with Assert.fail0:45
    Using Assert.fail to check validation logic in a try:catch2:23
    An introduction to the JUnit Assertions API
    Structuring unit tests with Arrange:Act:Assert2:04
    Understanding execution of assertions and JUnit's fail-fast test failure mechanism3:28
    Adding descriptive comments to assertions and test failures to aid diagnostics0:48
    Coding a unit test following Arrange-Act-Assert1:12
    Keeping test setup DRY with @Before4:55
    Understanding test fixture instantiation2:14
  • Unit Testing with Mock Objects and Mockito
    What is Mockito and what are Mock Objects?3:58
    Introduction to testing with mock objects4:56
    Configuring Projects to Use Mockito2:45
    Creating a project which uses JUnit and Mockito4:07
    Coding a Layered Architecture - Presentation Layer3:26
    Coding a Layered Architecture - Business Layer3:32
    Coding a Layered Architecture - Persistence Layer4:11
    Putting the correct packages in place to respect the layering2:44
    Writing a test for the Login Controller in the presentation layer9:48
    Understanding the test fixture setup when writing mock object based unit tests1:01
    Writing a test for the Authentication Service in the business layer3:57
    Thinking about design decisions when unit testing0:38
  • Looking at the Hamcrest Assertions Library
    Section Introduction0:58
    Evolving the Domain and Repository Classes6:36
    Ignoring Tests with @ignore4:17
    Implementing a Finder in the Repository0:57
    Implementing Business Logic in the Service3:13
    Configuring Maven to use Java 82:32
    Evolving the Repository Class1:32
    Adding a Parameter-driven Finder to the Service1:34
    Refactoring to Evolve a New Service1:16
    Generating Test Methods in the IDE and Toggling Between Production and Test Code1:26
    Introducing the JUnit Mockito Runner and @Mock1:04
    Analyzing the Production Code to Determine How to Write the Arrange Section3:58
    Using Mockito's @InjectMocks to Create the System Under Test with it's Dependencies1:33
    Keep Yourself Motivated by Checking the Happy Path Test Output2:06
    Using the JUnit Assertions API to write the Assert Section5:17
    Thinking About the Weaknesses of the JUnit Assertions API1:59
    The Importance of Checking Your Work as you Go2:29
    Upgrading a JUnit project to use the full Hamcrest version3:11
    Replacing JUnit assertions with Hamcrest assertions and using assertions with collections2:12
    Understanding and Reading Hamcrest Test Failures2:46
    Quick thoughts on Hamcrest individual vs collection Assertions0:29
    Don't invoke unneeded production code in your test classes1:01
    Understanding Evaluation of Hamcrest Matchers1:17
    Thinking about why we keep production code to a minimum in tests1:19
    Creating Complex Hamcrest Assertions with allOf and Property Matchers4:32

JUnit & Mockito Unit Testing for Java Developers

MS
Matt Speake

Matt Speaker | Java Technologist & Trainer

4.3/5 Instructor Rating: ★ ★ ★ ★

Matt Speake is a professional software engineer specializing in Java technologies. He has over 20 years of experience working everywhere from small startups to large global corporations and is the principal trainer at Zention in the UK.

Description

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? This course packs all the good stuff that's been distilled down through the years - it's the best practice and gets you up and running with knowing the stuff the APIs don't tell you. This course covers writing tests with JUnit and mock objects-based unit tests with Mockito. You'll also learn how to harness the power of Hamcrest to do more powerful assertions.

4.7/5 average rating: ★ ★ ★ ★

  • Access 61 lectures & 2 hours of content 24/7
  • Write unit tests confidently using JUnit
  • Appreciate mocking & mock objects
  • Use Mockito to create test fixtures, stub methods by programmatic & annotation-driven test setup
  • Analyze production code to guide writing unit tests
  • Gain an appreciation of the JUnit Assertions API
  • Understand modern unit testing concepts & best practices
  • Write assertions using Hamcrest

Specs

Important Details

  • Length of time users can access this course: lifetime
  • Access options: desktop & mobile
  • Certificate of completion included
  • Redemption deadline: redeem your code within 30 days of purchase
  • Updates included
  • Experience level required: beginner

Requirements

  • Some knowledge of coding in Java to at least a basic level

Terms

  • Unredeemed licenses can be returned for store credit within 30 days of purchase. Once your license is redeemed, all sales are final.
Your cart is empty. Continue Shopping!
Processing order...