@Test public void genereate_password() { assertThat(cryptoService.generateRandomPassword()).isNotEmpty().hasSize(9); }
public String generateRandomPassword(){ Random random = new Random(); return random.ints(48,122) .filter(i-> (i<57 || i>65) && (i <90 || i>97)) .mapToObj(i -> (char) i) .limit(9) .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) .toString(); }
CryptoService { public String generateRandomPassword(){ Random random = new Random(); return random.ints(48,122) .filter(i-> (i<57 || i>65) && (i <90 || i>97)) .mapToObj(i -> (char) i) .limit(9) .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) .toString(); } }
CryptoService { public String generateRandomPassword(){ Random random = new Random(); return random.ints(48,122) .filter(i-> (i<57 || i>65) && (i <90 || i>97)) .mapToObj(i -> (char) i) .limit(9) .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) .toString(); }  }
CryptoService { public String generateRandomPassword(){ Random random = new Random(); return random.ints(48,122) .filter(i-> (i<57 || i>65) && (i <90 || i>97)) .mapToObj(i -> (char) i) .limit(9) .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) .toString(); }  String passwordHash(String password); String generateRandomPassword(); }
CryptoService { public String generateRandomPassword(){ Random random = new Random(); return random.ints(48,122) .filter(i-> (i<57 || i>65) && (i <90 || i>97)) .mapToObj(i -> (char) i) .limit(9) .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) .toString(); }  String passwordHash(String password); String generateRandomPassword();  }