### Question:
CacheKeyBuilder implements IdentifierGenerator { @Override public String buildKey(final String username, final String password, final URI serverAddress) { try { return Base64.encodeBase64String( (USERNAME_PASSWORD_SALT + username + password + serverAddress.toString()).getBytes("utf-8")); } catch (final UnsupportedEncodingException e) { throw new Error(e); } }  @Override String buildKey(final String username, final String password, final URI serverAddress); @Override String buildKey(final String username, final String salt, final URI privateKeyLocation,
            final URI serverAddress);  }### Answer:
@Test public void testBuildKeyUsernamePassword() throws Exception { final String username = "username"; final String password = "password"; final URI serverAddress = URI.create("www.google.com"); final String expected = Base64.encodeBase64String( (CacheKeyBuilder.USERNAME_PASSWORD_SALT + username + password + serverAddress.toString()) .getBytes("utf-8")); assertThat(builder.buildKey(username, password, serverAddress)).isEqualTo(expected); }
@Test public void testBuildKeyUsernamePrivateKey() throws Exception { final String username = "username"; final String salt = "salt"; final URI privateKeyLocation = URI.create("/somewhere/on/ze/disk"); final URI serverAddress = URI.create("www.google.com"); final String expected = Base64.encodeBase64String((CacheKeyBuilder.PRIVATE_KEY_SALT + username + salt + privateKeyLocation.toString() + serverAddress.toString()).getBytes("utf-8")); assertThat(builder.buildKey(username, salt, privateKeyLocation, serverAddress)).isEqualTo(expected); }