MyInteger { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MyInteger myInteger = (MyInteger) o; return value == myInteger.value; } MyInteger(int value); int get(); boolean isEven(); boolean isOdd(); boolean isPrime(); static boolean isEven(int v); static boolean isOdd(int v); static boolean isPrime(int v); static boolean isEven(MyInteger v); static boolean isOdd(MyInteger v); static boolean isPrime(MyInteger v); @Override boolean equals(Object o); boolean equals(int v); boolean equals(MyInteger v); static int parseInt(char[] c); static int parseInt(String c); @Override String toString();  }
@Test @DisplayName("测试equals函数的各个版本") void testEquals(){ assertTrue(new MyInteger(10).equals(10)); assertTrue(new MyInteger(20).equals(new MyInteger(20))); }