DateChanger { @SuppressWarnings("deprecation") Date replaceWithRandomDate(Date date) { Date newDate = date; if (newDate == null) { newDate = new Date(); } newDate.setYear(random.nextInt(100)); newDate.setMonth(random.nextInt(12)); newDate.setDate(random.nextInt(31)); return newDate; }  void setSeed(long seed);  }
@Test public void testReplaceWithRandomDate() { String result = sdf.format(dateChanger.replaceWithRandomDate(dateToModify)); assertEquals("14-03-1963", result); String result2 = sdf.format(dateChanger.replaceWithRandomDate(null)); assertEquals("17-10-1971", result2); }