com.google.testing.threadtester
Class CallLoggerFactory

java.lang.Object
  extended by com.google.testing.threadtester.CallLoggerFactory

public class CallLoggerFactory
extends Object

Creates a CallLogger for every instrumented class. A reference to this class is added to the bytecode of any class instrumented by the TestInstrumenter.

This class is made public in order to allow instrumented classes to call it, but it should not be called otherwise.

Author:
alasdair.mackintosh@gmail.com (Alasdair Mackintosh)

Method Summary
static CallLogger createLoggerForNewObject(Object obj)
          Method called by instrumented code from within the instrumented constructor.
static CallLoggerFactory getFactory()
          Gets a CallLoggerFactory instance.
 com.google.testing.threadtester.ObjectInstrumentationImpl getObjectInstrumentation(Object obj)
          Gets an ObjectInstrumentationImpl for a given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFactory

public static CallLoggerFactory getFactory()
Gets a CallLoggerFactory instance. This method is invoked by the instrumented classes.


getObjectInstrumentation

public com.google.testing.threadtester.ObjectInstrumentationImpl getObjectInstrumentation(Object obj)
Gets an ObjectInstrumentationImpl for a given object.

Throws:
IllegalArgumentException - if the object has not been instrumented.

createLoggerForNewObject

public static CallLogger createLoggerForNewObject(Object obj)
Method called by instrumented code from within the instrumented constructor. Creates a new CallLogger that the instrumented object can then use to record its internal method invocations.

Note that it is safe to call this multiple times for a given object. Only a single CallLogger will be returned.



Copyright © 2013. All Rights Reserved.