mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-27 17:00:50 +01:00
Fix configuration in queryable unit test extension
With this the queryable unit test extension (QueryableStoreExtension) uses the same jackson mapper configuration as in production.
This commit is contained in:
2
gradle/changelog/correct_mapper_for_queryable_tests.yaml
Normal file
2
gradle/changelog/correct_mapper_for_queryable_tests.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: fixed
|
||||
description: Mapper configuration in queryable unit test extension
|
||||
@@ -16,9 +16,11 @@
|
||||
|
||||
package sonia.scm.store;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.extension.AfterEachCallback;
|
||||
@@ -61,11 +63,15 @@ public class QueryableStoreExtension implements ParameterResolver, BeforeEachCal
|
||||
private SQLiteQueryableStoreFactory storeFactory;
|
||||
|
||||
private static ObjectMapper getObjectMapper() {
|
||||
// this should be the same as in ObjectMapperProvider
|
||||
return new ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
.registerModule(new Jdk8Module())
|
||||
.registerModule(new JavaTimeModule())
|
||||
.configure(JsonParser.Feature.IGNORE_UNDEFINED, true)
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
|
||||
.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true)
|
||||
.configure(SerializationFeature.WRITE_DATES_WITH_ZONE_ID, true)
|
||||
.setDateFormat(new StdDateFormat());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user