@Test public void createPasswordWithSpecifiedLength(){ String password = new Password(10).create(); assertNotNull(password); assertEquals(10,password.length()); }
public String create(){ StringBuilder sb = new StringBuilder(); for (int i = 0; i < length ; i++) { int charIndex = (int) (Math.random() * PASSCHARS.length); sb.append(PASSCHARS[charIndex]); } return sb.toString(); }
Password { public String create(){ StringBuilder sb = new StringBuilder(); for (int i = 0; i < length ; i++) { int charIndex = (int) (Math.random() * PASSCHARS.length); sb.append(PASSCHARS[charIndex]); } return sb.toString(); } }
Password { public String create(){ StringBuilder sb = new StringBuilder(); for (int i = 0; i < length ; i++) { int charIndex = (int) (Math.random() * PASSCHARS.length); sb.append(PASSCHARS[charIndex]); } return sb.toString(); } Password(Integer length); }
Password { public String create(){ StringBuilder sb = new StringBuilder(); for (int i = 0; i < length ; i++) { int charIndex = (int) (Math.random() * PASSCHARS.length); sb.append(PASSCHARS[charIndex]); } return sb.toString(); } Password(Integer length); String create(); }
Password { public String create(){ StringBuilder sb = new StringBuilder(); for (int i = 0; i < length ; i++) { int charIndex = (int) (Math.random() * PASSCHARS.length); sb.append(PASSCHARS[charIndex]); } return sb.toString(); } Password(Integer length); String create();  }