Skip to content

Commit 8716072

Browse files
committed
Try to reproduce #1074
1 parent 3aee590 commit 8716072

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void testProviderConfig() throws Exception
150150
assertEquals(4, m._deserializationContext._cache.cachedDeserializersCount());
151151
}
152152

153-
// [Issue#28]: ObjectMapper.copy()
153+
// [databind#28]: ObjectMapper.copy()
154154
public void testCopy() throws Exception
155155
{
156156
ObjectMapper m = new ObjectMapper();
@@ -263,4 +263,22 @@ public void testEmptyBeanSerializability()
263263
assertTrue(MAPPER.writer().without(SerializationFeature.FAIL_ON_EMPTY_BEANS)
264264
.canSerialize(EmptyBean.class));
265265
}
266+
267+
// for [databind#1074]
268+
public void testCopyOfParserFeatures() throws Exception
269+
{
270+
// ensure we have "fresh" instance to start with
271+
ObjectMapper mapper = new ObjectMapper();
272+
assertFalse(mapper.isEnabled(JsonParser.Feature.ALLOW_COMMENTS));
273+
mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
274+
assertTrue(mapper.isEnabled(JsonParser.Feature.ALLOW_COMMENTS));
275+
276+
ObjectMapper copy = mapper.copy();
277+
assertTrue(copy.isEnabled(JsonParser.Feature.ALLOW_COMMENTS));
278+
279+
// also verify there's no back-linkage
280+
copy.configure(JsonParser.Feature.ALLOW_COMMENTS, false);
281+
assertFalse(copy.isEnabled(JsonParser.Feature.ALLOW_COMMENTS));
282+
assertTrue(mapper.isEnabled(JsonParser.Feature.ALLOW_COMMENTS));
283+
}
266284
}

0 commit comments

Comments
 (0)