FileDocCategorySizeDatePackage
PrivilegedActionTest.javaAPI DocAndroid 1.5 API1568Wed May 06 22:41:06 BST 2009org.apache.harmony.security.tests.java.security

PrivilegedActionTest

public class PrivilegedActionTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
    
public voidtestRun()

        MyPrivilegedAction action = new MyPrivilegedAction();
        String result = AccessController.doPrivileged(action);
        assertEquals("return value not correct", "ok", result);
        assertTrue("run method was not called", action.called);

        MyPrivilegedAction2 action2 = new MyPrivilegedAction2();


        try {
            result = AccessController.doPrivileged(action2);
            fail("exception expected");
        } catch (RuntimeException e) {
            // expected exception
        }