Class PowerMockAgent


  • public final class PowerMockAgent
    extends java.lang.Object
    This is the "agent class" that initializes the PowerMock "Java agent". It is not intended for use in client code. It must be public, however, so the JVM can call the premain method, which as the name implies is called before the main method.
    See Also:
    premain(String, Instrumentation)
    • Field Detail

      • javaSpecVersion

        static final java.lang.String javaSpecVersion
      • jdk6OrLater

        static final boolean jdk6OrLater
      • instrumentation

        private static java.lang.instrument.Instrumentation instrumentation
    • Constructor Detail

      • PowerMockAgent

        private PowerMockAgent()
    • Method Detail

      • premain

        public static void premain​(java.lang.String agentArgs,
                                   java.lang.instrument.Instrumentation inst)
                            throws java.lang.Exception
        This method must only be called by the JVM, to provide the instrumentation object. In order for this to occur, the JVM must be started with "-javaagent:powermock-module-javaagent-nnn.jar" as a command line parameter (assuming the jar file is in the current directory).
        Throws:
        java.lang.Exception
      • agentmain

        public static void agentmain​(java.lang.String agentArgs,
                                     java.lang.instrument.Instrumentation inst)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • initialize

        private static void initialize​(java.lang.String agentArgs,
                                       java.lang.instrument.Instrumentation inst)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • instrumentation

        public static java.lang.instrument.Instrumentation instrumentation()
      • verifyInitialization

        public static void verifyInitialization()
      • initializeIfNeeded

        public static boolean initializeIfNeeded()
      • initializeIfPossible

        public static void initializeIfPossible()