Code example for SecurityPermission

Methods: checkGuard, getName

0
	/** 
	 * @tests java.security.Permission#checkGuard(java.lang.Object) 
	 */ 
	public void test_checkGuardLjava_lang_Object() { 
		// test method java.security.permission.checkGuard(object) 
		SecurityPermission permi = new SecurityPermission(
				"Testing the permission abstract class"); 
		String name = permi.getName();
		try { 
			permi.checkGuard(name);
		} catch (SecurityException e) {
			fail("security not granted when it is suppose to be : " + e);
		} 
	} 
 
	/** 
	 * @tests java.security.Permission#getName() 
	 */ 
	public void test_getName() { 
		// test method java.security.permission.getName() 
		SecurityPermission permi = new SecurityPermission("testing getName()");