Class TestSetupUtils
java.lang.Object
ru.vyarus.dropwizard.guice.test.util.TestSetupUtils
Guicey
TestEnvironmentSetup test utilities.- Since:
- 13.05.2022
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWrapper class forAutoCloseableobjects to grant automatic closing inside junit store. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<TestEnvironmentSetup>create(Class<? extends TestEnvironmentSetup>... extensions) Instantiates provided support objects.static voidexecuteSetup(ExtensionConfig config, org.junit.jupiter.api.extension.ExtensionContext context, ListenersSupport listeners) Execute all configured support objects.static StringgetContextTestName(org.junit.jupiter.api.extension.ExtensionContext context) Use display names, so would correctly show spock test name or junit test with @DisplayName.static TestEnvironmentSetup[]lookup()
-
Method Details
-
lookup
- Returns:
- environment setup objects from service lookup
-
create
@SafeVarargs public static List<TestEnvironmentSetup> create(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, ListenersSupport listeners) Execute all configured support objects. If object returns closable then register it in junit storage for automatic closing.- Parameters:
config- extension configcontext- junit extension contextlisteners- listeners support
-
getContextTestName
Use display names, so would correctly show spock test name or junit test with @DisplayName.- Parameters:
context- junit context- Returns:
- context string (test name of beforeAll and test + method for beforeEach)
-