Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 13, 2020
1 parent 624f84b commit 56f28ef
Showing 1 changed file with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,25 @@ public class CoerceFloatToIntTest extends BaseMapTest
private final ObjectReader READER_LEGACY_FAIL = DEFAULT_MAPPER.reader()
.without(DeserializationFeature.ACCEPT_FLOAT_AS_INT);

private final ObjectMapper MAPPER_TO_EMPTY; {
MAPPER_TO_EMPTY = newJsonMapper();
MAPPER_TO_EMPTY.coercionConfigFor(LogicalType.Integer)
.setCoercion(CoercionInputShape.Float, CoercionAction.AsEmpty);
}

private final ObjectMapper MAPPER_TRY_CONVERT; {
MAPPER_TRY_CONVERT = newJsonMapper();
MAPPER_TRY_CONVERT.coercionConfigFor(LogicalType.Integer)
.setCoercion(CoercionInputShape.Float, CoercionAction.TryConvert);
}

private final ObjectMapper MAPPER_TO_NULL; {
MAPPER_TO_NULL = newJsonMapper();
MAPPER_TO_NULL.coercionConfigFor(LogicalType.Integer)
.setCoercion(CoercionInputShape.Float, CoercionAction.AsNull);
}

private final ObjectMapper MAPPER_TO_FAIL; {
MAPPER_TO_FAIL = newJsonMapper();
MAPPER_TO_FAIL.coercionConfigFor(LogicalType.Integer)
.setCoercion(CoercionInputShape.Float, CoercionAction.Fail);
}
private final ObjectMapper MAPPER_TO_EMPTY = jsonMapperBuilder()
.withCoercionConfig(LogicalType.Integer, cfg ->
cfg.setCoercion(CoercionInputShape.Float, CoercionAction.AsEmpty))
.build();

private final ObjectMapper MAPPER_TRY_CONVERT = jsonMapperBuilder()
.withCoercionConfig(LogicalType.Integer, cfg ->
cfg.setCoercion(CoercionInputShape.Float, CoercionAction.TryConvert))
.build();

private final ObjectMapper MAPPER_TO_NULL = jsonMapperBuilder()
.withCoercionConfig(LogicalType.Integer, cfg ->
cfg.setCoercion(CoercionInputShape.Float, CoercionAction.AsNull))
.build();

private final ObjectMapper MAPPER_TO_FAIL = jsonMapperBuilder()
.withCoercionConfig(LogicalType.Integer, cfg ->
cfg.setCoercion(CoercionInputShape.Float, CoercionAction.Fail))
.build();

/*
/********************************************************
Expand Down

0 comments on commit 56f28ef

Please sign in to comment.