### Question:
StringGenerator { public static String generateString(@NonNull Random rng, @NonNull String characters, @NonNull int length) { char[] text = new char[length]; for (int i = 0; i < length; i++) { text[i] = characters.charAt(rng.nextInt(characters.length())); } return new String(text); }  static String generateString(@NonNull Random rng, @NonNull String characters, @NonNull int length);  }### Answer:
@Test public void generateString_run_expectValidRandomString() { String generatedString = StringGenerator.generateString(new Random(229348756533112L), m_charsString, m_length); Assert.assertTrue(generatedString.equals(EXPECTED_GENERATED_STRING)); }
@Test public void generateString_runWithRandom_expectInvalidRandomString() { String generatedString = StringGenerator.generateString(new Random(), m_charsString, m_length); Assert.assertFalse(generatedString.equals(EXPECTED_GENERATED_STRING)); }