Class TestResourcesClientFactory
java.lang.Object
io.micronaut.testresources.client.TestResourcesClientFactory
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 Summary
Modifier and TypeMethodDescriptionstatic TestResourcesClient
configuredAt
(URL configFile) Creates a new test resources client configured via a properties file.static TestResourcesClient
extractFrom
(io.micronaut.context.ApplicationContext context) Extracts theTestResourcesClient
from the givenApplicationContext
.static Optional<TestResourcesClient>
Creates a new test resources client configured via system properties.
-
Method Details
-
configuredAt
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
Creates a new test resources client configured via system properties.- Returns:
- a new test resources client, if system properties were found.
-
extractFrom
Extracts theTestResourcesClient
from the givenApplicationContext
.- Parameters:
context
- the application context- Returns:
- the test resources client
-