Committing Bjorn's unit test as per LANG-372 to show that this is indeed an issue; and is expected
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@594387 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f7a005e41b
commit
930b389bac
|
@ -971,4 +971,22 @@ public class ToStringBuilderTest extends TestCase {
|
||||||
assertEquals("<null>", ReflectionToStringBuilder.toString(null));
|
assertEquals("<null>", ReflectionToStringBuilder.toString(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Points out failure to print anything from appendToString methods using MULTI_LINE_STYLE.
|
||||||
|
* See issue LANG-372.
|
||||||
|
*/
|
||||||
|
class MultiLineTestObject {
|
||||||
|
Integer i = new Integer(31337);
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this).append("testInt", i).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAppendToStringUsingMultiLineStyle() {
|
||||||
|
MultiLineTestObject obj = new MultiLineTestObject();
|
||||||
|
ToStringBuilder testBuilder = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.appendToString(obj.toString());
|
||||||
|
assertEquals(testBuilder.toString().indexOf("testInt=31337"), -1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue