Class TestSetupUtils


  • public final class TestSetupUtils
    extends java.lang.Object
    Guicey TestEnvironmentSetup test utilities.
    Since:
    13.05.2022
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TestSetupUtils.ClosableWrapper
      Wrapper class for AutoCloseable objects to grant automatic closing inside junit store.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<TestEnvironmentSetup> create​(java.lang.Class<? extends TestEnvironmentSetup>... extensions)
      Instantiates provided support objects.
      static void executeSetup​(ExtensionConfig config, org.junit.jupiter.api.extension.ExtensionContext context)
      Execute all configured support objects.
      static void validateFields​(java.util.List<java.lang.reflect.Field> fields, boolean includeInstanceFields)
      Validate fields annotated with EnableSetup for correctness.
      • Methods inherited from class java.lang.Object

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

      • create

        @SafeVarargs
        public static java.util.List<TestEnvironmentSetup> create​(java.lang.Class<? extends TestEnvironmentSetup>... extensions)
        Instantiates provided support objects.
        Parameters:
        extensions - extension classes to instantiate
        Returns:
        extension instances
      • executeSetup

        public static void executeSetup​(ExtensionConfig config,
                                        org.junit.jupiter.api.extension.ExtensionContext context)
        Execute all configured support objects. If object returns closable then register it in junit storage for automatic closing.
        Parameters:
        config - extension config
        context - junit extension context
      • validateFields

        public static void validateFields​(java.util.List<java.lang.reflect.Field> fields,
                                          boolean includeInstanceFields)
        Validate fields annotated with EnableSetup for correctness.
        Parameters:
        fields - fields to validate
        includeInstanceFields - true to allow instance fields, false to break if instance field detected