### Question:
Randoms { public static <E extends Enum<E>> Set<E> randomEnumSet(final Class<E> enumClass) { final Set<E> randomEnumCollection = randomSubset(new HashSet<E>(Arrays.asList(enumClass.getEnumConstants()))); randomEnumCollection.add(randomEnum(enumClass)); return randomEnumCollection; }  static String randomString(final int length); static char randomChar(); static String randomString(); static String randomEmailAddress(); static String randomPhoneNumber(); static DateTime randomDateTime(); static LocalDateTime randomLocalDateTime(); static LocalDate randomLocalDate(); static LocalTime randomLocalTime(); static E randomEnum(final Class<E> enumClass); static Set<E> randomEnumSet(final Class<E> enumClass); static E randomEnumInSet(final Set<E> enumSet); static Set<T> randomSubset(final Set<T> set); static int randomInt(final int max); static float randomFloat(); static double randomDouble(); static long randomLong(); static boolean randomBoolean(); static BigDecimal randomBigDecimal(final int maxValue, final int precision); static BigDecimal randomPositiveBigDecimal(final int maxValue, final int precision); static int randomIntInRange(final int from, final int to); static String randomCreditCardNumber(final String prefix); static String randomId(); static T randomItem(final T[] array); static T randomItem(final Collection<T> collection); static Set<String> randomIdSet();  }### Answer:
@Test public void shouldReturnNotEmptyRandomEnumSet_givenEnumClass() { assertTrue("Need at least 5 possible enum values for viable test", TestEnum.values().length >= 5); final Set<Set<TestEnum>> randomEnumSets = new HashSet<>(); for (int n = 0; n < 100; n++) { final Set<TestEnum> randomEnumSet = Randoms.randomEnumSet(TestEnum.class); assertNotNull(randomEnumSet); assertFalse(randomEnumSet.isEmpty()); randomEnumSets.add(randomEnumSet); } assertTrue("100 random samples should not all be same enum set: " + randomEnumSets.iterator().next(), randomEnumSets.size() > 1); }