Assert Methods
Learn about a variety of assert methods used to test if the actual output matches the expected output.
We'll cover the following
There are a number of assert methods that are available with the import of the Assertions.*
package.
assertEquals()
The assertEquals()
method compares two values — the expected value and the actual value — to determine whether or not both are the same. A test method from the last lesson using assertEquals()
is reproduced here:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.