Class InstrumentedInstance


  • public class InstrumentedInstance
    extends java.lang.Object
    InstrumentedInstance instances serve two purposes: Internally to the framework they provide storage of traced method invocation information received from the remote execution via BytemanTestHelper->InstrumentedClass->this. To the framework user, they provide utility methods for verifying expectations relating to that remote execution e.g. the number of method calls made.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String className  
      private java.lang.Integer instanceId  
      private java.util.Queue<java.lang.String> methodTraces  
    • Constructor Summary

      Constructors 
      Constructor Description
      InstrumentedInstance​(java.lang.String className, java.lang.Integer instanceId)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void addMethodTrace​(java.lang.String methodName, java.lang.Object[] args)
      Record a method invocation.
      void assertMethodCallCount​(java.lang.String message, java.lang.String methodName, CallCount callCount)
      Checks that the number of known invocations of the given method falls within the specified range.
      int getInvocationCount​(java.lang.String methodName)
      Returns the number of known invocations of the given method upon the object instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • className

        private final java.lang.String className
      • instanceId

        private final java.lang.Integer instanceId
      • methodTraces

        private final java.util.Queue<java.lang.String> methodTraces
    • Constructor Detail

      • InstrumentedInstance

        InstrumentedInstance​(java.lang.String className,
                             java.lang.Integer instanceId)
    • Method Detail

      • addMethodTrace

        void addMethodTrace​(java.lang.String methodName,
                            java.lang.Object[] args)
        Record a method invocation.
        Parameters:
        methodName - the method that was traced.
        args - the parameters to the method call.
      • getInvocationCount

        public int getInvocationCount​(java.lang.String methodName)
        Returns the number of known invocations of the given method upon the object instance.
        Parameters:
        methodName - the method name to look for.
        Returns:
        the number of invocations seen.
      • assertMethodCallCount

        public void assertMethodCallCount​(java.lang.String message,
                                          java.lang.String methodName,
                                          CallCount callCount)
        Checks that the number of known invocations of the given method falls within the specified range.
        Parameters:
        message - the message to print in case of assertion failure.
        methodName - the method name to look for.
        callCount - the expected range for the invocation count.