mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-08 19:14:52 +00:00
Applying a unit test for LANG-299 and the fix that Francisco Benavent suggests.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@486377 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aaaa779108
commit
9b0b19a916
@ -881,7 +881,7 @@ public StrBuilder appendFixedWidthPadRight(Object obj, int width, char padChar)
|
||||
String str = (obj == null ? getNullText() : obj.toString());
|
||||
int strLen = str.length();
|
||||
if (strLen >= width) {
|
||||
str.getChars(0, strLen, buffer, size);
|
||||
str.getChars(0, width, buffer, size);
|
||||
} else {
|
||||
int padLen = width - strLen;
|
||||
str.getChars(0, strLen, buffer, size);
|
||||
|
@ -596,6 +596,13 @@ public void testAppendFixedWidthPadRight() {
|
||||
assertEquals("null-", sb.toString());
|
||||
}
|
||||
|
||||
// See: http://issues.apache.org/jira/browse/LANG-299
|
||||
public void testLang299() {
|
||||
StrBuilder sb = new StrBuilder(1);
|
||||
sb.appendFixedWidthPadRight("foo", 1, '-');
|
||||
assertEquals("f", sb.toString());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testAppendFixedWidthPadRight_int() {
|
||||
StrBuilder sb = new StrBuilder();
|
||||
|
Loading…
x
Reference in New Issue
Block a user