Browse files

remove unused size() method, and icrease coverage to 100%

  • Loading branch information...
1 parent 52b14ca commit b015ba7c30c441efce70cdb4d7dd39e83d0bd521 @rolfl rolfl committed Mar 27, 2012
View
9 core/src/java/org/jdom2/input/sax/TextBuffer.java
@@ -107,15 +107,6 @@ void append(final char[] source, final int start, final int count) {
}
/**
- * Returns the size of the text value.
- *
- * @return the number of charactes currently in the TextBuffer
- */
- int size() {
- return arraySize;
- }
-
- /**
* Clears the text value and prepares the TextBuffer for reuse.
*/
void clear() {
View
32 test/src/java/org/jdom2/input/sax/TestTextBuffer.java
@@ -0,0 +1,32 @@
+package org.jdom2.input.sax;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+@SuppressWarnings("javadoc")
+public class TestTextBuffer {
+
+ @Test
+ public void testIsAllWhitespace() {
+ TextBuffer tb = new TextBuffer();
+ tb.append(" ".toCharArray(), 0, 3);
+ assertTrue(tb.isAllWhitespace());
+ tb.append("frodo".toCharArray(), 0, 4);
+ assertFalse(tb.isAllWhitespace());
+ }
+
+ @Test
+ public void testToString() {
+ // this tests the expansion of the backing array.
+ final StringBuilder sb = new StringBuilder();
+ final TextBuffer tb = new TextBuffer();
+ final char[] data = "frodo".toCharArray();
+ for (int i = 1000; i >= 0; i--) {
+ sb.append(data);
+ tb.append(data, 0, data.length);
+ assertEquals(sb.toString(), tb.toString());
+ }
+ }
+
+}

0 comments on commit b015ba7

Please sign in to comment.