类 TestContextFactoriesUtils

java.lang.Object
cn.taketoday.test.context.util.TestContextFactoriesUtils

public abstract class TestContextFactoriesUtils extends Object
Collection of utilities for working with TodayStrategies within the Infra TestContext Framework.

Primarily intended for use within the TestContext framework.

从以下版本开始:
4.0 2023/6/15 21:14
作者:
Sam Brannen, Harry Yang
  • 字段详细资料

    • logger

      private static final cn.taketoday.logging.Logger logger
  • 构造器详细资料

    • TestContextFactoriesUtils

      public TestContextFactoriesUtils()
  • 方法详细资料

    • loadFactoryImplementations

      public static <T> List<T> loadFactoryImplementations(Class<T> factoryType)
      Load factory implementations of the given type via the TodayStrategies mechanism.

      This method utilizes a custom TodayStrategies.FailureHandler and DEBUG/TRACE logging that are specific to the needs of the Infra TestContext Framework.

      Specifically, this method looks up and instantiates all factoryType entries configured in all META-INF/today.strategies files on the classpath.

      If a particular factory implementation cannot be loaded due to a LinkageError or ClassNotFoundException, a DEBUG message will be logged, but the associated exception will not be rethrown. A RuntimeException or any other Error will be rethrown. Any other exception will be thrown wrapped in an IllegalStateException.

      类型参数:
      T - the factory type
      参数:
      factoryType - the interface or abstract class representing the factory
      返回:
      an unmodifiable list of factory implementations
      另请参阅:
      • TodayStrategies.forDefaultResourceLocation(ClassLoader)
      • TodayStrategies.load(Class, TodayStrategies.FailureHandler)
    • classNames

      private static List<String> classNames(Collection<?> components)