Class TestSetupUtils
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.test.util.TestSetupUtils
-
public final class TestSetupUtils extends java.lang.ObjectGuiceyTestEnvironmentSetuptest utilities.- Since:
- 13.05.2022
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestSetupUtils.ClosableWrapperWrapper class forAutoCloseableobjects 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 voidexecuteSetup(ExtensionConfig config, org.junit.jupiter.api.extension.ExtensionContext context, ListenersSupport listeners)Execute all configured support objects.static java.lang.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 Detail
-
lookup
public static TestEnvironmentSetup[] lookup()
- Returns:
- environment setup objects from service lookup
-
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, 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
public static java.lang.String getContextTestName(org.junit.jupiter.api.extension.ExtensionContext context)
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)
-
-