JUnit offers assertEquals and assertNotEquals methods that delegate to a "obj1.equals(obj2)" call. JUnit also offers assertArraysEquals methods to deep-compare arrays. JUnit does not offer assertArrayNotEquals methods, though.
TestNG special-cases assertEquals; for assertNotEquals(Object, Object), there's a runtime check for arrays: https://github.com/testng-team/testng/blob/d50b2ad2d6809d52131a07071fe229b1b901e08c/testng-asserts/src/main/java/org/testng/Assert.java#L2201
When converting tests from TestNG to JUnit, assertNotEquals in JUnit will not throw if two instances of arrays with the same content are passed into it. It fails on the TestNG line:
```
Object a1 = new int[] {1};
Object a2 = new int[] {1};
org.junit.jupiter.api.Assertions.assertNotEquals(a1, a2);
org.testng.Assert.assertNotEquals(a1, a2);
```
Related: https://github.com/junit-team/junit-framework/pull/4899
JTReg should therefore throw an error for when arrays are used in JUnit assert[Not]Equals(Object, Object) methods.
TestNG special-cases assertEquals; for assertNotEquals(Object, Object), there's a runtime check for arrays: https://github.com/testng-team/testng/blob/d50b2ad2d6809d52131a07071fe229b1b901e08c/testng-asserts/src/main/java/org/testng/Assert.java#L2201
When converting tests from TestNG to JUnit, assertNotEquals in JUnit will not throw if two instances of arrays with the same content are passed into it. It fails on the TestNG line:
```
Object a1 = new int[] {1};
Object a2 = new int[] {1};
org.junit.jupiter.api.Assertions.assertNotEquals(a1, a2);
org.testng.Assert.assertNotEquals(a1, a2);
```
Related: https://github.com/junit-team/junit-framework/pull/4899
JTReg should therefore throw an error for when arrays are used in JUnit assert[Not]Equals(Object, Object) methods.
- relates to
-
JDK-8307843 Use JUnit Jupiter API in tests instead of no or other frameworks
-
- Open
-