Error: Assertion Error Exception

An Assertion allows testing of correctness made in a program.

While executing assertion, it is believed to be true. If it fails, JVM throws an error named AssertionError. It is mainly used for testing purposes during development

Unlike normal exception/error handling, assertions are generally disabled at run-time. Assertions are mainly used to check logically impossible situations. For example, they can be used to check the state a code expects before it starts running or state after it finishes running.

There are 2 ways you can solve this error:

  1. By going to the Respective test file where the Error occurs and clicking on Run Test.

    This generates a Java Test Report with the stack trace giving the result of what was the expected value and what is the actual value generated from your logic.

    You can refactor your logic based on the test case result you have recieved.

  2. For the second method, you can refer to this FAQ to understand and examine the results accordingly.
    How do I test and evaluate test cases against my application code? :)