public void testClone() throws Exception { CharTermAttributeImpl t = new CharTermAttributeImpl(); char[] content = "hello".toCharArray(); t.copyBuffer(content, 0, 5); char[] buf = t.buffer(); CharTermAttributeImpl copy = TestToken.assertCloneIsEqual(t); assertEquals(t.toString(), copy.toString()); assertNotSame(buf, copy.buffer()); }
public void testResize() { CharTermAttributeImpl t = new CharTermAttributeImpl(); char[] content = "hello".toCharArray(); t.copyBuffer(content, 0, content.length); for (int i = 0; i < 2000; i++) { t.resizeBuffer(i); assertTrue(i <= t.buffer().length); assertEquals("hello", t.toString()); } }