Skip to content

Instantly share code, notes, and snippets.

@lovasoa
Created September 25, 2018 15:44
Show Gist options
  • Save lovasoa/3b813a0cfd1a496f58c90a70b16f3200 to your computer and use it in GitHub Desktop.
Save lovasoa/3b813a0cfd1a496f58c90a70b16f3200 to your computer and use it in GitHub Desktop.
@org.junit.Test
public void testClasses() {
class A {
}
A a = new A();
assertEquals(a, a);
assertTrue(new A[]{a, a, a}.equals(new A[]{a, a, a}));
assertEquals(new A(), new A());
}
@Test
public void testClassB() {
class B {
@Override
public boolean equals(Object other) {
return true;
}
}
assertEquals(new B(), new B());
assertEquals(new B().toString(), new B().toString()); // This is a hard one
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment