@Test public void shouldReturnRandomStringWithoutNumbers() { int length = 50; Generator<String> randomAlphabeticStringGenerator = new RandomAlphabeticStringGenerator(length); Set<String> generatedStrings = newHashSet(); for (int i = 0; i < 100; i++) { String nextString = randomAlphabeticStringGenerator.next(); generatedStrings.add(nextString); assertThat(nextString.length(), is(50)); assertThat(JAVA_LETTER.matchesAllOf(nextString), is(true)); } assertThat(generatedStrings, hasSize(100)); }
@Override public String next() { return RandomStringUtils.randomAlphabetic(length); }
RandomAlphabeticStringGenerator implements Generator<String> { @Override public String next() { return RandomStringUtils.randomAlphabetic(length); } }
RandomAlphabeticStringGenerator implements Generator<String> { @Override public String next() { return RandomStringUtils.randomAlphabetic(length); } RandomAlphabeticStringGenerator(int length); }
RandomAlphabeticStringGenerator implements Generator<String> { @Override public String next() { return RandomStringUtils.randomAlphabetic(length); } RandomAlphabeticStringGenerator(int length); @Override String next(); }
RandomAlphabeticStringGenerator implements Generator<String> { @Override public String next() { return RandomStringUtils.randomAlphabetic(length); } RandomAlphabeticStringGenerator(int length); @Override String next();  }