@Test public void testGenerateUserName() { String userName = underTest.generateUserName(); assertEquals(userName.length(), USERNAME_LENGTH); assertTrue(userName, userName.matches("[a-z]*")); }
public String generateUserName() { return ThreadLocalRandom.current().ints(0, MAX_RANDOM_INT_FOR_CHARACTER) .limit(USER_NAME_LENGTH).boxed() .map(i -> Character.toString((char) ('a' + i))) .collect(Collectors.joining()); }
UserGeneratorService { public String generateUserName() { return ThreadLocalRandom.current().ints(0, MAX_RANDOM_INT_FOR_CHARACTER) .limit(USER_NAME_LENGTH).boxed() .map(i -> Character.toString((char) ('a' + i))) .collect(Collectors.joining()); } }
UserGeneratorService { public String generateUserName() { return ThreadLocalRandom.current().ints(0, MAX_RANDOM_INT_FOR_CHARACTER) .limit(USER_NAME_LENGTH).boxed() .map(i -> Character.toString((char) ('a' + i))) .collect(Collectors.joining()); }  }
UserGeneratorService { public String generateUserName() { return ThreadLocalRandom.current().ints(0, MAX_RANDOM_INT_FOR_CHARACTER) .limit(USER_NAME_LENGTH).boxed() .map(i -> Character.toString((char) ('a' + i))) .collect(Collectors.joining()); }  String generateUserName(); String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname); }
UserGeneratorService { public String generateUserName() { return ThreadLocalRandom.current().ints(0, MAX_RANDOM_INT_FOR_CHARACTER) .limit(USER_NAME_LENGTH).boxed() .map(i -> Character.toString((char) ('a' + i))) .collect(Collectors.joining()); }  String generateUserName(); String updateUserName(String originalUserName, Optional<CloudPlatform> cloudPlatform, String dbHostname);  }