Skip to content

Commit

Permalink
Minor test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Nov 13, 2023
1 parent 734973b commit 5c9f0e0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;

public abstract class ModuleTestBase extends junit.framework.TestCase
Expand All @@ -27,9 +28,12 @@ public Validity validateBaseType(MapperConfig<?> config, JavaType baseType) {
*/

static ObjectMapper mapperWithModule() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new Jdk8Module());
return mapper;
return mapperBuilderWithModule().build();
}

static JsonMapper.Builder mapperBuilderWithModule() {
return JsonMapper.builder()
.addModule(new Jdk8Module());
}

@SuppressWarnings("deprecation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ static class OptionalDoubleBean {
}

private ObjectMapper MAPPER = mapperWithModule();
private ObjectMapper MAPPER_WITHOUT_COERCION = MAPPER.copy().disable(MapperFeature.ALLOW_COERCION_OF_SCALARS);
private ObjectMapper MAPPER_WITHOUT_COERCION = mapperBuilderWithModule()
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
.build();

/*
/**********************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public enum JavaTimeFeature implements JacksonFeature
* Default setting is enabled, for backwards-compatibility with
* Jackson 2.15.
*/
NORMALIZE_DESERIALIZED_ZONE_ID(true);
NORMALIZE_DESERIALIZED_ZONE_ID(true)
;

/**
* Whether feature is enabled or disabled by default.
Expand Down

0 comments on commit 5c9f0e0

Please sign in to comment.