Package wstxtest.util

Source Code of wstxtest.util.TestTextAccumulator

package wstxtest.util;

import java.util.*;

import junit.framework.TestCase;

import com.ctc.wstx.util.TextAccumulator;

/**
* Simple unit tests for testing {@link TextAccumulator}. That class
* is generally used to try to minimize shuffling between char arrays,
* Strings and StringBuilders -- most common case being that only one
* instance is passed, before a String is needed.
*/
public class TestTextAccumulator
    extends TestCase
{
    public void testBasic()
    {
        TextAccumulator acc = new TextAccumulator();

        acc.addText("foo");
        assertEquals("foo", acc.getAndClear());

        acc.addText("foo".toCharArray(), 0, 3);
        acc.addText("bar");
        assertEquals("foobar", acc.getAndClear());
    }
}
TOP

Related Classes of wstxtest.util.TestTextAccumulator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.