Class WithObjectMapper
java.lang.Object
fr.ght1pc9kc.testy.core.extensions.WithObjectMapper
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeAllCallback
,org.junit.jupiter.api.extension.BeforeEachCallback
,org.junit.jupiter.api.extension.Extension
,org.junit.jupiter.api.extension.ParameterResolver
,org.junit.jupiter.api.extension.TestInstantiationAwareExtension
public class WithObjectMapper
extends Object
implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.ParameterResolver
Allow getting a Jackson ObjectMapper in Tests.
By default this extension search and register modules in classpath, but it is possible to pass specific module list at creation time.
The SerializationFeature.WRITE_DATES_AS_TIMESTAMPS
feature is disable, only no null
properties was included in serialization.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Allow to build a more complex ObjectMapper withModule
and MixinNested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeAll
(org.junit.jupiter.api.extension.ExtensionContext context) void
beforeEach
(org.junit.jupiter.api.extension.ExtensionContext context) builder()
com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper
(org.junit.jupiter.api.extension.ExtensionContext context) resolveParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) boolean
supportsParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
getTestInstantiationExtensionContextScope
-
Constructor Details
-
WithObjectMapper
public WithObjectMapper()
-
-
Method Details
-
builder
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeAll
in interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) - Specified by:
supportsParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
-
resolveParameter
public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) - Specified by:
resolveParameter
in interfaceorg.junit.jupiter.api.extension.ParameterResolver
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper(org.junit.jupiter.api.extension.ExtensionContext context)
-