### Question:
CompareUtil { public static boolean compareObjectsAndNull(Object object1, Object object2) { if ((object1 == null && object2 == null) || (object1 != null && object1.equals(object2))) { return true; } else { return false; } }  static boolean compareObjectsAndNull(Object object1, Object object2); static boolean compareArraysAndNull(Object[] arg1, Object[] arg2); static boolean compareListsAndNull(List arg1, List arg2);  }### Answer:
@Test public void testNullObjectsEqual() throws InterruptedException { Calendar instance = null; Calendar copy = null; Assert.assertTrue(CompareUtil.compareObjectsAndNull(instance, copy)); }
@Test public void testNullObjectsNotEqual() throws InterruptedException { Calendar instance = null; Calendar copy = Calendar.getInstance(); Assert.assertTrue(!CompareUtil.compareObjectsAndNull(instance, copy)); }
@Test public void testObjectsEqual() throws InterruptedException { Calendar instance = Calendar.getInstance(); Calendar copy = Calendar.getInstance(); copy.setTimeInMillis(instance.getTimeInMillis()); Assert.assertTrue(CompareUtil.compareObjectsAndNull(instance, copy)); }
@Test public void testObjectsNotEqual() throws InterruptedException { Calendar instance = Calendar.getInstance(); Calendar copy = Calendar.getInstance(); copy.set(Calendar.YEAR, 1980); Assert.assertTrue(!CompareUtil.compareObjectsAndNull(instance, copy)); }