Class ThreadSafeMockingProgress


  • public class ThreadSafeMockingProgress
    extends java.lang.Object
    Provides access to the MockingProgress of a corresponding Thread. Every Thread in Mockito has it s own MockingProgress to avoid data races while stubbing.
    • Field Detail

      • MOCKING_PROGRESS_PROVIDER

        private static final java.lang.ThreadLocal<MockingProgress> MOCKING_PROGRESS_PROVIDER
    • Constructor Detail

      • ThreadSafeMockingProgress

        private ThreadSafeMockingProgress()
    • Method Detail

      • mockingProgress

        public static final MockingProgress mockingProgress()
        Returns the MockingProgress for the current Thread.

        IMPORTANT: Never assign and access the returned MockingProgress to an instance or static field. Thread safety can not be guaranteed in this case, cause the Thread that wrote the field might not be the same that read it. In other words multiple threads will access the same MockingProgress.

        Returns:
        never null