Class TestSetupUtils
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.test.util.TestSetupUtils
-
public final class TestSetupUtils extends java.lang.Object
GuiceyTestEnvironmentSetup
test utilities.- Since:
- 13.05.2022
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TestSetupUtils.ClosableWrapper
Wrapper class forAutoCloseable
objects 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 void
executeSetup(ExtensionConfig config, org.junit.jupiter.api.extension.ExtensionContext context)
Execute all configured support objects.static void
validateFields(java.util.List<java.lang.reflect.Field> fields, boolean includeInstanceFields)
Validate fields annotated withEnableSetup
for correctness.
-
-
-
Method Detail
-
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)
Execute all configured support objects. If object returns closable then register it in junit storage for automatic closing.- Parameters:
config
- extension configcontext
- junit extension context
-
validateFields
public static void validateFields(java.util.List<java.lang.reflect.Field> fields, boolean includeInstanceFields)
Validate fields annotated withEnableSetup
for correctness.- Parameters:
fields
- fields to validateincludeInstanceFields
- true to allow instance fields, false to break if instance field detected
-
-