Question: Specifications of the Assert Class The Assert library class includes several public methods to assert if the actual result is equal to the expected result.

Specifications of the Assert Class
The Assert library class includes several public methods to assert if the actual result is equal to the expected result. There are different assert methods of different Java data type. There are also complimentary assert methods to assert if the actual result is not equal to the expected result. For example, for the int data type, the Assert class provides these two complimentary asset methods:
public static void assertEqualsInt (int actual, int expected)
public static void assertNotEqualsInt (int actual, int expected)
If the assertion is true in either of these complimentary methods, the method prints out the actual result, the expected result, and a green PASS indicator.
If the assertion is not true in either of these complimentary methods, the method prints out the actual result, the expected result, and a red FAIL indicator.
Here is an example of the output of invoking assertEqualsInt()where the assertion is true:
And here is another example of the output of invoking assertEqualsString() where the assertion is false:
The complete specifications of all the public components of the Assert class are:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!