String dn5 = "UID=tomas,CN=tomas,OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com"; String cnpostfix5 = " (VPN)"; String newdn5 = CertTools.insertCNPostfix(dn5,cnpostfix5); assertEquals("UID=tomas,CN=tomas (VPN),OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com", newdn5);
  public void test11TestInsertCNPostfix() throws Exception {      log.debug(">test11TestInsertCNPostfix()");            // Test the regular case with one CN beging replaced with " (VPN)" postfix      String dn1 = "CN=Tomas G,OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com";      String cnpostfix1 = " (VPN)";            String newdn1 = CertTools.insertCNPostfix(dn1,cnpostfix1);      assertEquals("CN=Tomas G (VPN),OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com", newdn1);            // Test case when CN doesn't exist      String dn2 = "OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com";      String newdn2 = CertTools.insertCNPostfix(dn2,cnpostfix1);       assertEquals("OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com", newdn2);            // Test case with two CNs in DN only first one should be replaced.      String dn3 = "CN=Tomas G,CN=Bagare,OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com";        String newdn3 = CertTools.insertCNPostfix(dn3,cnpostfix1);       assertEquals("CN=Tomas G (VPN),CN=Bagare,OU=users,OU=orgunit,DC=se,DC=bigcorp,DC=com", newdn3);       // Test case with two CNs in reversed DN       String dn4 = "dc=com,dc=bigcorp,dc=se,ou=orgunit,ou=users,cn=Tomas G,CN=Bagare";      String newdn4 = CertTools.insertCNPostfix(dn4,cnpostfix1);       assertEquals("dc=com,dc=bigcorp,dc=se,ou=orgunit,ou=users,cn=Tomas G (VPN),CN=Bagare", newdn4);            log.debug("<test11TestInsertCNPostfix()");  }