ParameterPlaceholder extends ArgumentPlaceholder { @Override protected String format(Object param) { return super.format(param); }  void setContext(Method method, int idx, Object[] parameters); String process(String formatPattern);  }
@Test public void testFormatForCustomObjectReplacesCarriageReturnWithTheirPrintableCounterpart() { final TestToString parameter = new TestToString("\r"); String result = underTest.format(parameter); assertThat(result).isEqualTo("\\r"); }
@Test public void testFormatForCustomObjectReplacesCarriageReturnsWithTheirPrintableCounterpartEvenIfWithText() { final TestToString parameter = new TestToString("test\rtest\r"); String result = underTest.format(parameter); assertThat(result).isEqualTo("test\\rtest\\r"); }
@Test public void testFormatForCustomObjectReplacesLineFeedWithTheirPrintableCounterpart() { final TestToString parameter = new TestToString("\n"); String result = underTest.format(parameter); assertThat(result).isEqualTo("\\n"); }
@Test public void testFormatForCustomObjectReplacesLineFeedsWithTheirPrintableCounterpartEvenIfWithText() { final TestToString parameter = new TestToString("1\n2\n3"); String result = underTest.format(parameter); assertThat(result).isEqualTo("1\\n2\\n3"); }
@Test public void testFormatForCustomObjectReplacesCarriageReturnsAndLineFeedsWithTheirPrintableCounterpart() { final TestToString parameter = new TestToString( "A very\r\nlong text\nwith multiple\rdifferent newline\n\rvariations."); String result = underTest.format(parameter); assertThat(result).isEqualTo("A very\\r\\nlong text\\nwith multiple\\rdifferent newline\\n\\rvariations."); }