Skip to content

Commit b015ba7

Browse files
committed
remove unused size() method, and icrease coverage to 100%
1 parent 52b14ca commit b015ba7

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

core/src/java/org/jdom2/input/sax/TextBuffer.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,6 @@ void append(final char[] source, final int start, final int count) {
106106
arraySize += count;
107107
}
108108

109-
/**
110-
* Returns the size of the text value.
111-
*
112-
* @return the number of charactes currently in the TextBuffer
113-
*/
114-
int size() {
115-
return arraySize;
116-
}
117-
118109
/**
119110
* Clears the text value and prepares the TextBuffer for reuse.
120111
*/
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.jdom2.input.sax;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
7+
@SuppressWarnings("javadoc")
8+
public class TestTextBuffer {
9+
10+
@Test
11+
public void testIsAllWhitespace() {
12+
TextBuffer tb = new TextBuffer();
13+
tb.append(" ".toCharArray(), 0, 3);
14+
assertTrue(tb.isAllWhitespace());
15+
tb.append("frodo".toCharArray(), 0, 4);
16+
assertFalse(tb.isAllWhitespace());
17+
}
18+
19+
@Test
20+
public void testToString() {
21+
// this tests the expansion of the backing array.
22+
final StringBuilder sb = new StringBuilder();
23+
final TextBuffer tb = new TextBuffer();
24+
final char[] data = "frodo".toCharArray();
25+
for (int i = 1000; i >= 0; i--) {
26+
sb.append(data);
27+
tb.append(data, 0, data.length);
28+
assertEquals(sb.toString(), tb.toString());
29+
}
30+
}
31+
32+
}

0 commit comments

Comments
 (0)