@Test
	public void testWritePassword() throws NoSuchAlgorithmException {
		// Write double hashed password to mock persistence handler
		String id = "DouglasAdams";
		byte[] passwordHash = new BigInteger(
				"769b1075dbb0ef9643e7bcc606acb023af49e00bce9518d6afcb14e6ba52d168",
				16).toByteArray();
		ph.writePassword(id, passwordHash);

		// The salt changes every time, so we have to recalculate the hash to
		// double check it
		Password password = (Password) mph.data.get(id.toLowerCase());
		byte[] salt = password.getSalt();
		byte[] seed = new byte[passwordHash.length + salt.length];

		// Copy bytes manually from passwordHash into seed
		for (int i = 0; i < passwordHash.length; i++) {
			seed[i] = passwordHash[i];
		}
		// Copy bytes manually from salt into seed
		for (int i = 0; i < salt.length; i++) {
			seed[i + passwordHash.length] = salt[i];
		}

		MessageDigest test = MessageDigest.getInstance("SHA-256");
		test.update(seed);

		assertTrue("Hashes did not match.",
				Arrays.equals(test.digest(), password.getPassword()));
	}