Skip to content

Commit 2bba091

Browse files
authored
Replace deprecated API for configuring ObjectMapper (#8395)
1 parent 98d6fc0 commit 2bba091

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2024 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package io.helidon.builder.test;
1818

19+
import com.fasterxml.jackson.databind.json.JsonMapper;
1920
import io.helidon.builder.test.testsubjects.CustomNamed;
2021

2122
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
@@ -50,8 +51,9 @@ void testIt() throws Exception {
5051
customNamed.toString(),
5152
equalTo("CustomNamed{stringSet=[b, a, y],stringList=[b, a, b, y],stringToIntegerMap={b=1, e=2, a=3}}"));
5253

53-
ObjectMapper mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true)
54-
.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
54+
ObjectMapper mapper = JsonMapper.builder().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true)
55+
.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
56+
.build();
5557
DefaultPrettyPrinter printer = new DefaultPrettyPrinter();
5658
String json = mapper.writer(printer).writeValueAsString(customNamed);
5759
assertThat(json, equalTo("{\n" + " \"stringSet\" : [ \"b\", \"a\", \"y\" ]\n" + "}"));

0 commit comments

Comments
 (0)