コード例 #1
0
 /** Test of getEncryptedPasswordToString method, of class PassCrypt. */
 @Test
 public void testGetPasswordEncrypted() throws UnsupportedEncodingException {
   System.out.println("getPasswordEncrypted");
   byte[] password = "******".getBytes();
   PassCrypt instance = new PassCrypt("dus", "dus");
   String result = instance.getEncryptedPasswordToString(password);
   System.out.println(result);
   //        assertEquals(expResult, result);
   // TODO review the generated test code and remove the default call to fail.
   // fail("The test case is a prototype.");
 }
コード例 #2
0
  /** Test of passwordChange method, of class PassCrypt. */
  @Test
  public void testPasswordChange() throws Exception {
    System.out.println("passwordChange");
    String username = "******";
    String password = "******";
    PassCrypt instance = new PassCrypt("username", "password");

    instance.passwordChange(username, password);
    password = salt + password;
    MessageDigest md = MessageDigest.getInstance("MD5");
    byte[] encPasswordTest = md.digest(password.getBytes("UTF-8"));
    String encPasswordTestString = instance.getEncryptedPasswordToString(encPasswordTest);

    XMLhandler xml = new XMLhandler();
    String encPassword = xml.getPassword();
    assertEquals(encPassword, encPasswordTestString);
    System.out.println("Testvalue: " + encPasswordTestString);
    System.out.println("Storedvalue: " + encPassword);
  }