Code example for X500Principal

Methods: getName

0
 
	/** 
	 * @tests javax.security.auth.x500.X500Principal#getName(java.lang.String) 
	 */ 
	public void test_getNameLjava_lang_String() { 
		X500Principal principal = new X500Principal(
				"CN=Dumbledore, OU=Administration, O=Hogwarts School, C=GB"); 
		String canonical = principal.getName(X500Principal.CANONICAL);
		String expected = "cn=dumbledore,ou=administration,o=hogwarts school,c=gb";
		assertEquals("CANONICAL output differs from expected result", expected,
				canonical);
	} 
     
    /** 
     * @tests javax.security.auth.x500.X500Principal#getName(java.lang.String, java.util.Map) 
     */ 
    public void test_getNameLjava_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");