### Question:
UnsafeIDGenerator { public static String timeBasedRandom(int length) { String date = DateValues.toString(new Date(), TIME_FORMAT, UTC_TIME_ZONE); if (length < TIME_BASED_RANDOM_MIN_LENGTH) length = TIME_BASED_RANDOM_MIN_LENGTH; return date + random(length - TIME_FORMAT.length()); } private  UnsafeIDGenerator(); static String random(int length); static String timeBasedRandom(int length); static final int TIME_BASED_RANDOM_MIN_LENGTH; }### Answer:
@Test public void timeBasedRandom() { int length = 20; String id = UnsafeIDGenerator.timeBasedRandom(length); Assert.assertEquals(id.length(), length); System.out.println(id); }
@Test public void timeBasedRandomMinLength() { int length = 17; String id = UnsafeIDGenerator.timeBasedRandom(length); Assert.assertNotEquals(length, id.length()); Assert.assertEquals(UnsafeIDGenerator.TIME_BASED_RANDOM_MIN_LENGTH, id.length()); System.out.println(id); }