The assert. assert equals method asserts that two objects are equal. If they are not, an Assertion Error without a message is thrown. If expected and actual are null, they are considered equal. AssertEquals() internally uses the equals() function to validate if two objects are equal. Hence, the below test passes as it validates if the object values are equal.
package
ordertests.com;
import
static
org. junit. Assert. *;
import
org. junit. Test;
public
class
Assertion2 {
public
void
test() {
String s1 = new
String("HELLO ......my name is darshana");
String s2 = new
String("HELLO ,my name is dash");
assertEquals ("the values are not equal", s1, s2);
}
}