@Test
public void testUpdateSSHHostPrincipalsDuplicateValues() {

    InstanceCertManager instance = new InstanceCertManager(null, null, null, true);
    SshHostCsr csr = new SshHostCsr();
    String[] principals = new String[3];
    principals[0] = "principal1";
    principals[1] = "principal2";
    principals[2] = "principal4";
    csr.setPrincipals(principals);
    String[] xprincipals = new String[3];
    xprincipals[0] = "principal1";
    xprincipals[1] = "principal2";
    xprincipals[2] = "principal5";
    csr.setXPrincipals(xprincipals);
    SSHCertRecord record = new SSHCertRecord();
    instance.updateSSHHostPrincipals(csr, record);
    Set<String> result = new HashSet<>(Arrays.asList(record.getPrincipals().split(",")));
    assertEquals(result.size(), 4);
    assertTrue(result.contains("principal1"));
    assertTrue(result.contains("principal2"));
    assertTrue(result.contains("principal4"));
    assertTrue(result.contains("principal5"));
}