Package org.powermock.modules.agent
Class PowerMockAgent
- java.lang.Object
-
- org.powermock.modules.agent.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 thepremain
method, which as the name implies is called before themain
method.- See Also:
premain(String, Instrumentation)
-
-
Field Summary
Fields Modifier and Type Field Description private static PowerMockClassTransformer
classTransformer
private static java.lang.instrument.Instrumentation
instrumentation
(package private) static java.lang.String
javaSpecVersion
(package private) static boolean
jdk6OrLater
-
Constructor Summary
Constructors Modifier Constructor Description private
PowerMockAgent()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
agentmain(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)
static PowerMockClassTransformer
getClasstransformer()
private static void
initialize(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)
static boolean
initializeIfNeeded()
static void
initializeIfPossible()
static java.lang.instrument.Instrumentation
instrumentation()
static void
premain(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)
This method must only be called by the JVM, to provide the instrumentation object.static void
verifyInitialization()
-
-
-
Field Detail
-
javaSpecVersion
static final java.lang.String javaSpecVersion
-
jdk6OrLater
static final boolean jdk6OrLater
-
classTransformer
private static final PowerMockClassTransformer classTransformer
-
instrumentation
private static java.lang.instrument.Instrumentation instrumentation
-
-
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
-
getClasstransformer
public static PowerMockClassTransformer getClasstransformer()
-
instrumentation
public static java.lang.instrument.Instrumentation instrumentation()
-
verifyInitialization
public static void verifyInitialization()
-
initializeIfNeeded
public static boolean initializeIfNeeded()
-
initializeIfPossible
public static void initializeIfPossible()
-
-