### Question:
Randoms { public static <T> T randomItem(final T[] array) { return array[Randoms.randomInt(array.length)]; }  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 shouldReturnRandomItemFromArray() { final String[] itemArray = { "ALPHA", "BRAVO", "CHARLIE", "DELTA", "ECHO", "FOXTROT", "GOLF", "HOTEL", "INDIA", "JULIET" }; final List<String> itemCollection = Arrays.asList(itemArray); for (int n = 0; n < SAMPLE_SIZE; n++) { final String item = Randoms.randomItem(itemArray); assertThat(itemCollection, hasItem(item)); } }
@Test public void shouldReturnRandomItemFromCollection() { final ArrayList<String> itemCollection = new ArrayList<>(); itemCollection.add("ALPHA"); itemCollection.add("BRAVO"); itemCollection.add("CHARLIE"); itemCollection.add("DELTA"); itemCollection.add("ECHO"); itemCollection.add("FOXTROT"); itemCollection.add("GOLF"); itemCollection.add("HOTEL"); itemCollection.add("INDIA"); itemCollection.add("JULIET"); for (int n = 0; n < SAMPLE_SIZE; n++) { final String item = Randoms.randomItem(itemCollection); assertThat(itemCollection, hasItem(item)); } }