Formatting output so that Intellij Idea shows diffs for two texts

后端 未结 2 1234
暖寄归人
暖寄归人 2021-02-04 02:09

I would like to be able to print in the logs a message for which intellij idea would present a nice way of comparing two objects (strings). This happens automatically for the er

2条回答
  •  -上瘾入骨i
    2021-02-04 02:21

    IntelliJ IDEA is using the hardcoded regular expression. If the text matches the pattern, it will suggest to click to view the difference.

    The pattern is:

    expected: but was:
    

    Output should match the format of assertEquals or assertThat.

    The exact patterns are somewhat scattered around the code in IDEA, but some are e.g. here.

提交回复
热议问题