assertSame/assertNotSame broken after GITHUB-2296
See original GitHub issueTestNG Version
7.4.0 (7.3.0 worked fine)
Expected behavior
assertSame(object.clone(), object)
returns false
Actual behavior
assertSame(object.clone(), object)
returns true
Description
assertSame/assertNotSame should use ==
operator, but not equals
method to compare the same objects to identify they are the same object or different objects
Is the issue reproductible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
Test case sample
public void testAssertNotSame() {
Contrived object = new Contrived(2);
Contrived object2 = new Contrived(2);;
Assert.assertNotSame(object2, object);
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
assertEquals doesn't work for sets · Issue #2296 · cbeust/testng
I implemented a fix but couldn't create a pull request, so here it is: add the following code in method org.testng.Assert#assertEquals( ...
Read more >Broken assertSame/assertNotSame after #2460 #2616 - GitHub
Problem is present for any custom object which has implemented its own equals method. import java.util.Objects; import org.testng.Assert; import ...
Read more >testng/CHANGES.txt at master · cbeust/testng - GitHub
Fixed: GITHUB-2486: assertSame/assertNotSame broken after GITHUB-2296 (Vitalii Diravka). Fixed: GITHUB-2490: assertNotEquals returns fast when argument is ...
Read more >Breaking change of assertEquals(Object, Object) in TestNG ...
I am currently trying to upgrade TestNG to 7.0.0 and I found that version 6.9.4 changed the behavior of Assert.assertEquals . It was:...
Read more >changes in behavior with assertEquals(Collection) et al #2540
Do you think it is feasible to run testng test subset in cbeust/testng GitHub Actions to validate that upcoming TestNG releases do not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are there any plans to release 7.4.1 with this fix? Broken assertion seems like important enough part of test framework to release fix/patch?
It is too much effort to deal with many branches. The fix will be included in the next release.