Skip to content

Commit 75bdb73

Browse files
authored
Try fixing #4168 wrt linefeed diff (#4170)
1 parent a1b7557 commit 75bdb73

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ public void testCopyWith() throws JsonProcessingException {
221221
assertEquals("Black", readResult.get("color").asText());
222222
assertEquals(true, readResult.get("free").asBoolean());
223223
assertEquals(204, readResult.get("pages").asInt());
224-
String readResultAsString = "{\n \"color\" : \"Black\",\n \"free\" : \"true\",\n \"pages\" : \"204.04\"\n}";
225-
assertEquals(readResultAsString, mapper.writeValueAsString(readResult));
224+
String readResultAsString = _unifyLFs("{\n \"color\" : \"Black\",\n \"free\" : \"true\",\n \"pages\" : \"204.04\"\n}");
225+
assertEquals(readResultAsString, _unifyLFs(mapper.writeValueAsString(readResult)));
226226

227227
// validate properties
228228
Boolean mapperConfig1 = mapper._deserializationConfig.isEnabled(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES);
@@ -243,6 +243,10 @@ public void testCopyWith() throws JsonProcessingException {
243243
);
244244
}
245245

246+
private String _unifyLFs(String doc) {
247+
return doc.replaceAll("[\r\n]+", "\n");
248+
}
249+
246250
public void testFailedCopy() throws Exception
247251
{
248252
NoCopyMapper src = new NoCopyMapper();

0 commit comments

Comments
 (0)