### Question:
DnUtils { public static String buildNormalizedProxyDN(String subjectDN, String issuerDN, String proxiedSubjectDNs, String proxiedIssuerDNs) { StringBuilder sb = new StringBuilder(); for (String escapedDN : buildNormalizedDNList(subjectDN, issuerDN, proxiedSubjectDNs, proxiedIssuerDNs)) { if (sb.length() == 0) sb.append(escapedDN); else sb.append('<').append(escapedDN).append('>'); } return sb.toString(); }  static String[] splitProxiedDNs(String proxiedDNs, boolean allowDups); static String[] splitProxiedSubjectIssuerDNs(String proxiedDNs); static String buildProxiedDN(String... dns); static Collection<String> buildNormalizedDNList(String subjectDN, String issuerDN, String proxiedSubjectDNs, String proxiedIssuerDNs); static String buildNormalizedProxyDN(String subjectDN, String issuerDN, String proxiedSubjectDNs, String proxiedIssuerDNs); static String getCommonName(String dn); static String[] getOrganizationalUnits(String dn); static String getShortName(String dn); static boolean isServerDN(String dn); static String getUserDN(String[] dns); static String getUserDN(String[] dns, boolean issuerDNs); static String[] getComponents(String dn, String componentName); static String normalizeDN(String userName); static final String PROPS_RESOURCE; static final String SUBJECT_DN_PATTERN_PROPERTY; }### Answer:
@Test public void testBuildNormalizedProxyDN() { String expected = "sdn<idn>"; String actual = DnUtils.buildNormalizedProxyDN("SDN", "IDN", null, null); assertEquals(expected, actual); expected = "sdn1<idn1><sdn2><idn2>"; actual = DnUtils.buildNormalizedProxyDN("SDN1", "IDN1", "SDN2", "IDN2"); assertEquals(expected, actual); expected = "sdn1<idn1><sdn2><idn2><sdn3><idn3>"; actual = DnUtils.buildNormalizedProxyDN("SDN1", "IDN1", "SDN2<SDN3>", "IDN2<IDN3>"); assertEquals(expected, actual); expected = "sdn1<idn1><sdn2><idn2><sdn3><idn3>"; actual = DnUtils.buildNormalizedProxyDN("SDN1", "IDN1", "<SDN2><SDN3>", "<IDN2><IDN3>"); assertEquals(expected, actual); }
@Test(expected = IllegalArgumentException.class) public void testBuildNormalizedProxyDNTooMissingIssuers() { DnUtils.buildNormalizedProxyDN("SDN", "IDN", "SDN2<SDN3>", null); }
@Test(expected = IllegalArgumentException.class) public void testBuildNormalizedProxyDNTooFewIssuers() { DnUtils.buildNormalizedProxyDN("SDN", "IDN", "SDN2<SDN3>", "IDN2"); }
@Test(expected = IllegalArgumentException.class) public void testBuildNormalizedProxyDNTooFewSubjects() { DnUtils.buildNormalizedProxyDN("SDN", "IDN", "SDN2", "IDN2<IDN3>"); }
@Test(expected = IllegalArgumentException.class) public void testBuildNormalizedProxyDNSubjectEqualsIssuer() { DnUtils.buildNormalizedProxyDN("SDN", "IDN", "SDN2", "SDN2"); }
@Test(expected = IllegalArgumentException.class) public void testBuildNormalizedProxyDNSubjectDNInIssuer() { DnUtils.buildNormalizedProxyDN("SDN", "IDN", "SDN2", "CN=foo,OU=My Department"); }