Annotation Type ConfineMetaClassChanges


@Retention(RUNTIME)
@Target({TYPE,METHOD})
@Repeatable(Container.class)
public @interface ConfineMetaClassChanges
Confines any changes made to the meta classes of the specified classes to the annotated scope. This is done by installing new meta classes when the scope is entered, and restoring the previously installed meta classes when the scope is left. Note that this only works reliably as long as spec execution is single-threaded.

If a spec class is annotated, the meta classes are restored to as they were before setupSpec() was executed, after cleanupSpec was executed.

If a feature method is annotated, the meta classes are restored to as they were after setup() was executed, before cleanup() is executed. For a data-driven feature method, meta classes are restored after each iteration.

Note: If this extension is applied, then it will use acquire a lock for Resources.META_CLASS_REGISTRY

See Also:
ResourceLock
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static interface  ConfineMetaClassChanges.Container  
  • Required Element Summary

    Required Elements
    Modifier and Type Required Element Description
    Class<?>[] value
    The classes whose meta class changes are to be confined.
  • Element Details

    • value

      Class<?>[] value
      The classes whose meta class changes are to be confined.