Assert. Equals & assert. areequal

Source: Internet
Author: User

We are writing unittest'sCodeI accidentally wrote assert. areequal as assert. equals, and the results made me suffer for a while.
We all know that assert. Equals (Object A, object B) is a correct method that is equal.
However, assert. Equals (Object A, object B) is indeed not equal.
According to the data, assert. Equals inherits from Microsoft's object. Equals, so it is inferred that the result is true in any case;
But I still don't quite understand. I don't know which of the following questions can be answered:
1. How to infer that the assert. Equals (Object A, object B) results are true;
2. Microsoft uses objects. equals (Object A), why does assert use two parameters assert. equals (Object A, object B), which is not easy to confuse assert. areequal and assert. equals?

In short, be careful when using assert. areequal in the future. Do not make any mistakes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.