DateChanger { @SuppressWarnings("deprecation") Date modifyDateValue(Date date) { if (date == null) { return null; } int choice = random.nextInt(3); switch (choice) { case 0: date.setYear(random.nextInt(200)); break; case 1: date.setMonth(random.nextInt(12)); break; case 2: date.setDate(random.nextInt(31) + 1); break; default: break; } return date; }  void setSeed(long seed);  }
@Test public void testModifyDateValue() { String result = sdf.format(dateChanger.modifyDateValue(dateToModify)); assertEquals("23-08-1982", result); Date result2 = dateChanger.modifyDateValue(null); assertTrue(result2 == null); }