### Question:
InstanceCertManager { public boolean updateSSHCertRecord(SSHCertRecord certRecord, boolean refresh) { if (sshStore == null) { return false; } if (certRecord == null) { return true; } boolean result = false; try (SSHRecordStoreConnection storeConnection = sshStore.getConnection()) { if (refresh && storeConnection.updateSSHCertRecord(certRecord)) { return true; } result = storeConnection.insertSSHCertRecord(certRecord); } catch (Exception ex) { LOGGER.error("Unable to store ssh certificate record for principal {} - {}", certRecord.getPrincipals(), ex.getMessage()); } return result; } InstanceCertManager(final PrivateKeyStore keyStore, Authorizer authorizer, HostnameResolver hostnameResolver,
            boolean readOnlyMode); void setCertStore(CertRecordStore certStore); void setSSHStore(SSHRecordStore sshStore); CertificateAuthorityBundle getCertificateAuthorityBundle(final String name); List<X509CertRecord> getUnrefreshedCertsNotifications(String serverHostName, String provider); X509CertRecord getX509CertRecord(final String provider, X509Certificate cert); X509CertRecord getX509CertRecord(final String provider, final String instanceId,
            final String service); boolean updateX509CertRecord(X509CertRecord certRecord); boolean deleteX509CertRecord(final String provider, final String instanceId,
            final String service); boolean insertX509CertRecord(X509CertRecord certRecord); String generateX509Certificate(final String csr, final String keyUsage, int expiryTime); String getCACertificate(); InstanceIdentity generateIdentity(String csr, String cn, String keyUsage,
            int expiryTime); String getX509CertificateSigner(); SSHCertificates generateSSHCertificates(Principal principal, SSHCertRequest certRequest); boolean generateSSHIdentity(Principal principal, InstanceIdentity identity, final String hostname,
            final String csr, SSHCertRecord sshCertRecord, final String certType); boolean authorizeLaunch(Principal providerService, String domain, String service,
            StringBuilder errorMsg); boolean verifyCertRefreshIPAddress(final String ipAddress); boolean verifyInstanceCertIPAddress(final String provider, final String ipAddress); boolean validPrincipals(final String hostname, SSHCertRecord sshCertRecord, SshHostCsr sshHostCsr); void logX509Cert(final Principal principal, final String ip, final String provider,
            final String instanceId, final X509Certificate x509Cert); SSHCertRecord getSSHCertRecord(final String instanceId, final String service); boolean updateSSHCertRecord(SSHCertRecord certRecord, boolean refresh); boolean enableCertStoreNotifications(NotificationManager notificationManager, RolesProvider rolesProvider, String serverName); boolean enableSSHStoreNotifications(NotificationManager notificationManager, RolesProvider rolesProvider, String serverName);  }### Answer:
@Test public void testUpdateSSHCertRecord() { InstanceCertManager instance = new InstanceCertManager(null, null, null, true); instance.setSSHSigner(null); SSHRecordStore certStore = Mockito.mock(SSHRecordStore.class); SSHRecordStoreConnection certConnection = Mockito.mock(SSHRecordStoreConnection.class); when(certStore.getConnection()).thenReturn(certConnection); instance.setSSHStore(certStore); assertTrue(instance.updateSSHCertRecord(null, true)); when(certConnection.updateSSHCertRecord(ArgumentMatchers.isA(SSHCertRecord.class))).thenReturn(true); SSHCertRecord sshCertRecord = new SSHCertRecord(); assertTrue(instance.updateSSHCertRecord(sshCertRecord, true)); instance.shutdown(); }