IOpenShiftSSHKey key = null;
int originalNumOfKeys = user.getSSHKeys().size();
try {
// pre-conditions
String publicKeyPath = SSHKeyTestUtils.createDsaKeyPair();
IUser user = new TestConnectionBuilder().defaultCredentials().disableSSLCertificateChecks().create().getUser();
// operation
int newNumOfKeys = user.getSSHKeys().size();
assertThat(user.getSSHKeys().size()).isEqualTo(originalNumOfKeys);
String newKeyName = SSHKeyTestUtils.createRandomKeyName();
user.addSSHKey(newKeyName, new SSHPublicKey(publicKeyPath));
newNumOfKeys = user.getSSHKeys().size();
// verification
assertThat(newNumOfKeys).isEqualTo(originalNumOfKeys + 1);
} finally {
SSHKeyTestUtils.silentlyDestroyKey(key);