All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jdom2.input.sax.TestTextBuffer Maven / Gradle / Ivy

Go to download

A complete, Java-based solution for accessing, manipulating, and outputting XML data

The newest version!
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());
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy