assertNotEquals() method

This lesson demonstrates how to use assertNotEquals() method in JUnit 5 to assert test conditions.

assertNotEquals() method

Assertions API provide static assertNotEquals() method. This method helps us in validating that actual and expected values are not equal. This method uses equals() to assert the in-equality of actual and expected value.

  • If the actual value is not equal to expected value then the test case will pass.
  • If the actual value is equal to expected value then the test case will fail.

There are basically three useful overloaded methods for assertNotEquals:-

Get hands-on with 1400+ tech skills courses.