### Question:
SMSAuditor extends ConfigAuditor { public static String getRealmFromDN(String dn) { Stack stack = new Stack(); for (Iterator<RDN> itr = DN.valueOf(dn).iterator(); itr.hasNext();) { RDN rdn = itr.next(); if (LDAPUtils.rdnType(rdn).equals("ou") && LDAPUtils.rdnValue(rdn).equals("GlobalConfig")) { return null; } else if (LDAPUtils.rdnType(rdn).equals("o")) { stack.push(LDAPUtils.rdnValue(rdn)); } } StringBuilder builder = new StringBuilder(); while(!stack.empty()) { builder.append("/"); builder.append(stack.pop()); } if(builder.length() > 0) { return builder.toString(); } return "/"; } @Inject  SMSAuditor(@Named("amSMS") Debug debug, AuditEventPublisher auditEventPublisher,
            AuditEventFactory auditEventFactory, @Assisted SSOToken runAs, @Assisted("realm") @Nullable String realm,
            @Assisted("objectId") String objectId, @Assisted Map<String, Object> initialState, Set<SMSAuditFilter> filters); void auditModify(ModificationItem[] mods); static String getRealmFromDN(String dn);  }### Answer:
@Test(dataProvider = "DNprovider") public void testGetRealmFromDN(String dn, String expectedRealm) throws Exception { Reporter.log(SMSAuditor.getRealmFromDN(dn) + " - " + expectedRealm); assertThat(SMSAuditor.getRealmFromDN(dn)).isEqualTo(expectedRealm); }