Class FieldDefaulter

  • All Implemented Interfaces:
    PowerMockTestListener

    public class FieldDefaulter
    extends AbstractPowerMockTestListenerBase
    A test listener that automatically set all instance fields to their default values after each test method. E.g. an object field is set to null, an int field is set to 0 and so on.
    • Constructor Detail

      • FieldDefaulter

        public FieldDefaulter()
    • Method Detail

      • afterTestMethod

        public void afterTestMethod​(java.lang.Object testInstance,
                                    java.lang.reflect.Method method,
                                    java.lang.Object[] arguments,
                                    TestMethodResult testResult)
                             throws java.lang.Exception
        Description copied from class: AbstractPowerMockTestListenerBase
        Provides an empty implementation.
        Specified by:
        afterTestMethod in interface PowerMockTestListener
        Overrides:
        afterTestMethod in class AbstractPowerMockTestListenerBase
        method - The test method that is currently executed.
        arguments - The arguments passed to the test method if any. May be an empty array but never null.
        testResult - The outcome of the test method.
        Throws:
        java.lang.Exception - If something unexpected occurs.