Class TestResourcesClientFactory

java.lang.Object
io.micronaut.testresources.client.TestResourcesClientFactory

public final class TestResourcesClientFactory extends Object
A factory responsible for creating a TestResourcesClient. Because this client is used in services which are loaded via service loading during application context building, we can't use regular dependency injection, so this factory creates an application context to create the client.
  • Method Details

    • configuredAt

      public static TestResourcesClient configuredAt(URL configFile)
      Creates a new test resources client configured via a properties file.
      Parameters:
      configFile - the URL to the configuration properties file.
      Returns:
      a new test resources client.
    • fromSystemProperties

      public static Optional<TestResourcesClient> fromSystemProperties()
      Creates a new test resources client configured via system properties.
      Returns:
      a new test resources client, if system properties were found.
    • extractFrom

      public static TestResourcesClient extractFrom(io.micronaut.context.ApplicationContext context)
      Extracts the TestResourcesClient from the given ApplicationContext.
      Parameters:
      context - the application context
      Returns:
      the test resources client