Code example for X500Principal

Methods: getName

0
 
	/** 
	 * @tests javax.security.auth.x500.X500Principal#X500Principal(java.lang.String) 
	 */ 
	public void test_ConstructorLjava_lang_String() { 
		X500Principal principal = new X500Principal(
				"CN=Hermione Granger, O=Apache Software Foundation, OU=Harmony, L=Hogwarts, ST=Hants, C=GB"); 
		String name = principal.getName();
		String expectedOuput = "CN=Hermione Granger,O=Apache Software Foundation,OU=Harmony,L=Hogwarts,ST=Hants,C=GB";
		assertEquals("Output order precedence problem", expectedOuput, name);
	} 
     
    /** 
     * @tests javax.security.auth.x500.X500Principal#X500Principal(java.lang.String, java.util.Map) 
     */ 
    public void test_ConstructorLjava_lang_String_java_util_Map(){ 
        Map<String, String> keyword = new HashMap<String, String>();
        keyword.put("CN", "2.19");
        keyword.put("OU", "1.2.5.19");
        keyword.put("O", "1.2.5");
        X500Principal X500p = new X500Principal("CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US ,CN=DD",keyword);