Unit Testing: Assertions & Assumptions in JUnit

Junit 5.7    |    Beginner
  • 9 videos | 1h 15m 2s
  • Includes Assessment
  • Earns a Badge
Assertions, a collection of utility methods in in JUnit, help assert the pass or fail status of test cases. The focus of this course is on assertions that allow you to set the conditions for the success and failure of test cases and assumptions to control the flow of execution in a test case. Begin with simple assert methods to compare the actual values of fields or return values of methods with their expected values. Then, use assertions that ensure your app's performance by failing a test if it takes too long to run, followed by assert methods that check an exception is thrown when invalid data is passed to a method. Next, use assumptions that check for conditions before executing a code block - effectively serving as control structures. When you're done, you'll have a working knowledge of using assertions in JUnit.


  • Discover the key concepts covered in this course
    Set a test to check that an actual value generated by a unit in an app matches the expected value
    Implement test cases that verify boolean data and objects
    Develop test cases that ensure a unit of an app can run within a specified time
    Build tests to verify that method calls throw an exception when invalid data is passed to it
  • Define a group of asserts and check whether two iterable objects contain the same data
    Configure a test case to execute only when a specified assumption is satisfied
    Set a block of code to execute when a specified assumption is met
    Summarize the key concepts covered in this course


  • 2m 19s
  • 9m 25s
  • Locked
    3.  Using Assert Methods and Their Converse Operations
    11m 38s
  • Locked
    4.  Testing for Timeouts and Nulls Using JUnit
    9m 59s
  • Locked
    5.  Checking for Exceptions Using JUnit
    10m 28s
  • Locked
    6.  Working with Specialized Assert Methods in JUnit
    10m 56s
  • Locked
    7.  Using Assumptions in Test Cases in JUnit
    10m 49s
  • Locked
    8.  Running Tests Using assumingThat in JUnit
    7m 41s
  • Locked
    9.  Course Summary
    1m 47s


Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.